$ perl -MO=Deparse -e '<*>' use File::Glob (); glob('*'); -e syntax OK #### foreach $file (@files) { open FH, $file or die "Error opening $file: $!\n"; #### for my $file (@files) { open my $fh, '<', $file or die "Error opening `$file': $!\n"; # do something with $fh # ... # no need for an explit close() } #### $ cat foo.pl #!/usr/bin/perl use strict; use warnings; my $file=shift; open my $fh, $file or die $!; print "The contents of `$file' are:\n", <$fh>; __END__ $ ./foo.pl aaa The contents of `aaa' are: asdfdaf sfdfdd sffgsdd $ ./foo.pl '|echo "Gotcha!">foo.pl' The contents of `|echo "Gotcha!">foo.pl' are: $ cat foo.pl Gotcha! #### elsif ( data =~ /^\x89PNG\x0d\x0a\x1a\x0a/) { type = 'PNG'; }