in reply to Backing up in a foreach loop.

As mentioned in the ChatterBox, you want redo.
foreach $key (sort (keys(%myHash))) { ... if (condition) { # Start over without advancing. # $key retains its current value. redo; } ... }