my @docs = <*.doc>; for my $file (@docs) { open my $fh, '<', $file or die "can not open file $file: $!"; while {<$fh>} ( # process your file here ) close $fh; }