in reply to Copying a list of files from a directory to a new directory
open FILE , '<' , "mylist.txt" || die "$!";
Not a direct answer to your question, but an incidental thought. The above quoted statement should be either
open FILE , '<' , "mylist.txt" or die "$!";
or else
open(FILE , '<' , "mylist.txt") || die "$!";
because the expression "mylist.txt" || die "$!" as quoted will be evaluated before the open happens, and the particular file name in the example (and almost any other file name) evaluates as true (i.e., it's not 0, '0', '' or undef; see What is true and false in Perl?), so the call to die will never be made no matter what happens with the open call. (Update: And see perlop for info on Operator Precedence and Associativity; the above is a precedence problem.)
P.S.: I tend to prefer the lexical filehandle syntax
my $filename = 'mylist.txt';
open my $filehandle, '<', $filename or die "opening '$filename': $!";
(update: or else maybe useautodie;).
Update: I've written above that almost any file name you can think of will evaluate as true in Perl. But let's say you actually had a file named '0'. In this case, what would happen given the quoted statement?
Give a man a fish: <%-{-{-{-<
|
|---|