my %systems = ( system1 => 'hostname_to_system1', system2 => 'hostname_to_system2', ... ); my $choice = menu; dftp( $systems{$choice} ); # sub menu { my @choices = (sort keys %systems) print "Please pick which system you wish to FTP to:\n"; foreach my $i ( 0 .. $#choices ) { printf( "%2i.) %s\n", $i+1, @choices($i)); } # get input ... assuming in $option; if ( $option eq 'q' ) { exit; # or an abort routine to handle cleaning up } elsif ( defined( $choices[$option-1] ) ) { return $choices[$option-1]; } else { print "Unknown option.\nPlease try again\n"; goto &menu; # yes, goto. Please don't give me the 'goto is evil' speach } }