in reply to Search a file with ids from another file
Side notes:
open my $IFILE, '<', $IDFILE || die "Could not open $IDFILE: $!";
This does not do what you think it does. General rule is: use high precedence logical operators to act on values, low precedence ones for flow control. Otherwise, do not omit parens.
while ( my $ifile_line = <$IFILE> ) { my $hits = substr($ifile_line, 0, 6); push @id_hits, $hits; }
FWIW, this is one of those cases in which slurping is ok:
my @id_hits=map substr($_, 0, 6), <$IFILE>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search a file with ids from another file
by sigzero (Novice) on May 07, 2007 at 20:29 UTC |