in reply to Continuing While Loop One Iteration After EOF
If you recognise that the body of the while loop is effectively a subroutine with implicit parameters, then it becomes natural to think of what you describe as (crudely):
doBody( $_ ) while( <FILEHANDLE> ); doBody( undef );
Which makes it clear that
Ie. When processing the file, or afterwards.
That probably indicates that there is some subset of the processing inside the body of the loop that should really be factored into a separate subroutine, rather than inlined. Leading to
while( <FILEHANDLE> ) { do some stuff; doTheFactoredStuff(); do some other stuff; } doTheFactoredStuff();
Which may suggest a better way of doing things--or not:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Continuing While Loop One Iteration After EOF
by jcc (Sexton) on Dec 21, 2005 at 18:34 UTC |