in reply to read different loops

<*.doc> returns a list of file names (see glob). If your current directory has more than one file with a .doc extension (i.e., a.doc, b.doc, c.doc), then more than one file name will be passed to open. You only want to pass 1 file name at a time to open. Also, you always want to check the success of open:
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; }