roik has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use diagnostics; my $line = (<DATA>); print "line ouside loop = $line"; foreach $line (<DATA>) { print "line from foreach = $line"; $line = (<DATA>) or print "error reading filehandle\n"; $line ||= "null\n"; print "line inside loop = $line"; } __DATA__ 1 2 3 4 5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to read a filehandle inside a loop
by broquaint (Abbot) on Oct 23, 2002 at 09:11 UTC | |
by roik (Scribe) on Oct 23, 2002 at 09:31 UTC | |
by broquaint (Abbot) on Oct 23, 2002 at 09:42 UTC | |
|
Re: Trying to read a filehandle inside a loop
by gjb (Vicar) on Oct 23, 2002 at 09:20 UTC | |
|
Re: Trying to read a filehandle inside a loop
by DapperDan (Pilgrim) on Oct 23, 2002 at 09:24 UTC |