open FH, '/etc/passwd' or die "Can't open /etc/passwd, $!"; my @matches = grep { chomp; /thing_to_match/ } ;