in reply to Re: Pattern Match Issue
in thread Pattern Match Issue
... Better would be while (defined (my $seq = <$IN2>)) {
AFAIK, current versions of Perl implicitly do this anyway:
#!/usr/bin/perl open my $IN2, "<", "foo.txt" or die; while (my $seq = <$IN2>) { print "line: '$seq'\n"; }
$ perl -MO=Deparse ./808927.pl die unless open my $IN2, '<', 'foo.txt'; while (defined(my $seq = <$IN2>)) { print "line: '${seq}'\n"; } ./808927.pl syntax OK
It's only when you write things like while (chomp(my $seq = <$IN2>)) that you run into problems... (because chomp returns the number of characters removed, which may be zero for the last line if it doesn't contain a "\n")
|
|---|