Yes, and we still have no idea what you are trying to accomplish, nor really enough detail to puzzle out an answer. If you are inside a while, you don't need to goto it. You can either next LABEL to it, or just fall through the bottom of the loop. With no idea what else is in the respective loops, it's extremely hard to be useful.
# use strict, etc...
OUTER:
while ( 1 )
{
# something1
last OUTER if ...something2...;
# something3
INNER:
while ( my $dir = readdir( $dh ) )
{
# something4
next INNER if ...something5...;
# something6
}
next OUTER if ...something5...;
# something7
}
Now, if some of the various somethings don't exist, you can simplify greatly. Fill in the somethings with what you want, try it, and if you are still having problems, post the code, the errors, the input and the expected output.