in reply to pulling value based on input
To access the read server and location use $servers{$server} and $locs{$loc} as shown below. You can - and should - also check if the given server and location really exists, which can be done with if (exists $servers{$server}) { } etc.
my %locs = ( one => '\c$\files', two => '\d$\stuff', three => '\d$\things' ); my %servers = ( ksl => '\\server1', krf => '\\server2' ); my $server = <STDIN>; chomp $server; my $loc = <STDIN>; chomp $loc; print $servers{$server}, "\n"; print $locs{$loc}, "\n";
|
|---|