in reply to Get out of "For Loop"!
This being Perl there are several right ways. Another one would be:
for (my $i = 0; $i < @{$data}; $i++) { my $email = $data->[$i]{'email'} || ''; my $name = $data->[$i]{'name'} || ''; unless ($email) { bad("No email address."); last; }else{ good("Email found."); } }
This does not test for validity of the email, of course, but presumably you do that elsewhere. And presumably the good and bad subroutines are defined somewhere.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Get out of "For Loop"!
by morgon (Priest) on Oct 13, 2010 at 19:26 UTC | |
by TomDLux (Vicar) on Oct 18, 2010 at 15:14 UTC |
In Section
Seekers of Perl Wisdom