Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Exit while loop on first match

by jynx (Priest)
on Apr 30, 2002 at 21:16 UTC ( #163163=note: print w/ replies, xml ) Need Help??


in reply to Exit while loop on first match


Possibly not the style you wish to go with,

But in such a situation i would use a bare block loop. Mostly i use them when there are multiple loop modifiers that i want to simplify, and this (sort of) fits that description. In any event, it gets rid of extra variables...

# note this is completely untested... my $match = 0; my $pb = HTML::TokeParser->new(\$content); { $pb->get_tag('b', '/b'); my $tb = $pb->get_text(); if ($tb =~ /^\d+$/) { $num = $tb; last; } redo; }
something like that maybe,
jynx


Comment on Re: Exit while loop on first match
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://163163]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-04-23 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (541 votes), past polls