in reply to Re: Continuing While Loop One Iteration After EOF
in thread Continuing While Loop One Iteration After EOF
and of course, if the file actually contains AFTERFILE, you're in trouble.while (defined($_ = <INHANDLE>) || ($_ = "AFTERFILE")){ stuff; last if $_ eq "AFTERFILE"; }
So if you don't mind undef as your special after loop value, it's probably easiest to do something like
LOOP: { $_ = <>; stuff; redo LOOP if defined; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Continuing While Loop One Iteration After EOF
by traveler (Parson) on Dec 22, 2005 at 17:15 UTC |