http://www.perlmonks.org?node_id=536276

Win has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: next unless - and then 'until'
by japhy (Canon) on Mar 13, 2006 at 15:42 UTC
    Do you mean you want a condition that has to be met ONCE and then is "sticky"? Like:
    my $keep_going = 0; while (my $job_B = readdir DIR_B) { print "D\n"; # ||= here means "assign to $keep_going if $keep_going is false" $keep_going ||= $job_B =~ /Out_$tag\.txt$/; next unless $keep_going; ... }

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: next unless - and then 'until'
by zer (Deacon) on Mar 13, 2006 at 23:24 UTC
    #!/usr/bin/perl -w $tag= "al"; opendir (DIR_B, ".."); $c= 0; {TEMP: while(my $job_B=readdir(DIR_B)){ print "D $c\n"; next unless $job_B =~ /Out_$tag\.txt$/; } } print "DONE\n"; close (DIR_B);opendir (DIR_B, ".."); goto ("TEMP");
    this will scan the directory. once it finishes reading itll close the file handle for a new one or the same or whatever. You need to be more specific but this might be the goto you were looking for
    A reply falls below the community's threshold of quality. You may see it by logging in.