Write a program that copies all files with a .ico filename extension in a directory hierarchy to a directory named icons in your home directory. (Hint: Use the File::Find and File::Copy modules.)

What will be an ideal response?


$ cat icon-copy.pl
use File::Find;
use File::Copy 'copy';
find( \&handle_file, '.' );
sub handle_file {
if ( -f $File::Find::Name && $File::Find::name =~ /\.ico$/ ) {
copy( $File::Find::name, '~/icons' );
}
}

Computer Science & Information Technology

You might also like to view...

Which of the following statements about inheriting base class constructors is false?

a. To inherit a base class’s constructors, you write the following line of code in the derived class definition (BaseClass is the base class’s name): using BaseClass::BaseClass; b. If an inherited base-class constructor has default arguments, the line of code in Part (a) causes the compiler to generate a derived-class constructor with the same default arguments. c. By default, each inherited constructor has the same access level (public, protected or private) as its corresponding base-class constructor. d. If the derived class does not explicitly define constructors, the compiler generates a default constructor in the derived class—even if it inherits other constructors from its base class.

Computer Science & Information Technology

The format specifier ________ is a placeholder for an int value.

a. %n b. %d c. %int d. %s

Computer Science & Information Technology

If you write the code Public Property Hour As Integer, the compiler would generate property code that would use the Private instance variable __________.

a) Hour b) Hour_ c) _Hour_ d) _Hour

Computer Science & Information Technology

An advantage of structured programming is that it works well with the concept of modular programming.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology