How do I break an outer loop from an inner one in Perl?
Use a label:
OUTER:
foreach my $x (@x) {
foreach my $y (@z) {
foreach my $z (@z) {
if (something()) {
last OUTER;
}
# do stuff
}
# do stuff
}
# do stuff
}
The "last LABEL" syntax is described in the documentation.