in reply to simple loop

There are already a few other good replies, but none of the other monks have mentioned that fact that your code does not actually have a loop anywhere. It's easy to discern where you want the loop, but I think it should at least be pointed out that you don't have one.

Here's a version using a while loop:

while (1) { chomp(my $choice = <STDIN>); if ($choice == 1) { &hash1; } elsif ($choice == 2) { &hash2; } elsif ($choice == 3) { &hash3; } else { print "ERROR: Please type in either 1, 2 or 3.\n"; redo; } last; }

Update: fixed code to actually do what was asked.

You might want to add some checking to make sure $choice looks like a number before trying to use numeric comparisons against it. Scalar::Util's looks_like_number subroutine might be just the ticket.