in reply to simple loop
You can enclose the logic in curlies to form a bare block and replace the exit with redo.
I'd prefer to organize the code refs as a real hash like so:
{ chomp (my $choice = <STDIN>); if (exists $codehash{$choice}) { &{$codehash{$choice}}; } else { print "ERROR: Please type in either 1, 2 or 3.\n"; redo; } }
After Compline,
Zaxo
|
|---|