Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: pulling value based on input

by mscharrer (Hermit)
on Sep 25, 2008 at 09:25 UTC ( [id://713607]=note: print w/replies, xml ) Need Help??


in reply to pulling value based on input

Hi,
please use <code> tags for your code examples and <c></c> for your inline code. Also using perltidy to tidy up your longer code is very much recommended. This makes your posts much more readable.

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";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://713607]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found