"Charles K. Clarkson" <[EMAIL PROTECTED]> writes: > Harry Putnam <[EMAIL PROTECTED]> wrote:
[...] Wants to exit a while loop inside a File::Find \&wanted sub routine. Is exiting the while loop sufficient.. or does one need to exit from the current file being offered by `sub find()' > : So using the `next LABEL' technique how do I > : designate the wanted() subroutine as target? > : Something like this: > : > : sub LABEL: wanted { > > I haven't tested it, but I would think this would fail. > > : open(FILE,"<File::Find::name"); > : while (<FILE>){ > : if(something) { > : then do something > : }else{ > : next LABEL; > : } > : } > : } > > As I understand this, you want to immediately open > a new file found in current file with the current while > loop. Is that correct? Yes... > First, we need to know a few things. > > Are you wanting to recursively call the entire > wanted() subroutine? I guess not no. I just want to go on to the next file it has found > Or do you just want to call the while loop portion > only and continue with the execution after? Yes > Is it alright to clobber the currently open file or > do we need to continue processing it afterward? It needs to be clobbered. This file has been processed to a point where it has already failed tests that show if this file has what we want. > Is there any test needed to be certain we are not > opening the same file again? I don't think so, but not really sure of the internals of File::Find. I was assuming if I threw down the file it hands me. It would hand me a new different one. The files offered by `wanted()' are filtered thru an `if' clause I left this fact out by accident. sub wanted { if(/^\d+$/){.processing.. open(FILE),"$File::Find::name"; while(<FILE>{ if(something){ do something }else{ next LABEL; } } } } Looking at this simplified diagram... I think I may have answered my own question.. I want to exit to just above the first `if' filter. I guess just exiting the while loop will do that. so: LABEL: while(<FILE>){ processing} is sufficient? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>