Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

next unless - and then 'until'

by Win (Novice)
on Mar 13, 2006 at 15:40 UTC ( [id://536276]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://536276]
Approved by friedo
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-19 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found