This is greatly simplified - I hope it makes sense. :)
I am trying to loop over rows of an array doing a test. If the test fails, I want to go all the way back to the outer loop, which the documentation suggests will work only with foreach.
#!/usr/bin/perl -w
use strict;
my @x =
(
['aaaaa', 'bbbbb', 'ccccc', 'ddddd',],
['eeeee', 'fffff', 'ggggg', 'hhhhh',],
['iiiii', 'jjjjj', 'kkkkk', 'lllll',],
);
for my $i (1 .. 1000)
{
for my $a (@x)
{
my $ifails = 0;
for my $j (0 .. (scalar @$a) - 1 )
{
<get external data string for pattern matching here, put i
+n $c>
if ($c =~ /$a->[$j]/) { $ifails++; }
}
if ($ifails > 1) { want to go to outer loop here, and not proc
+ess the next (and subsequent) row(s) }
}
}
Is there some way of doing that? Note that in the actual application, I do have more more processing below the inner loop, so a "last" statement at the test doesn't work.
Thank you in advance.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.