in reply to Continuing While Loop One Iteration After EOF
Hmmmm...
Two possible ways I could think of...
my $i = 1; while ((my $line = <INHANDLE>) || $i--) {}
or, just what has been said here
while (my $line = <INHANDLE>) { } continue { dosomething() if eof(INHANDLE); }
I would prefer the first, as the continue solution wouldn't enable the reuse of the while block.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Continuing While Loop One Iteration After EOF
by ikegami (Patriarch) on Dec 21, 2005 at 17:48 UTC | |
by ruoso (Curate) on Dec 21, 2005 at 18:08 UTC | |
by ikegami (Patriarch) on Dec 21, 2005 at 18:13 UTC | |
by davido (Cardinal) on Dec 21, 2005 at 18:25 UTC | |
by ruoso (Curate) on Dec 21, 2005 at 18:19 UTC |