open(SuitDoc,) || die "Cannot open file"; ... while ($line = ) { ... #### while (<>) { # read from file name(s) in @ARGV or from pipe ... #### use strict; # get into this habit my $suits = 'hearts|clubs|spades|diamonds'; while (<>) { if ( /($suits)/ ) { print $1; } }