my $id_file = 'id.txt'; my %id; open my $ID, "<", $id_file or die "Error opening $id_file $!"; while (<$ID>) { chomp; $id{$_} = 1; } close $ID; while (<>) { # assumes file 2 is passed to the script - to be adjusted + to real conditions my $key = $1 if /^(\w+)/; print if exists $id{$key}; }
In reply to Re: Extracting lines starting with a pattern from an array
by Laurent_R
in thread Extracting lines starting with a pattern from an array
by Alessandro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |