in reply to Exit while loop on first match
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...
something like that maybe,# 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; }
|
|---|