Hi: By first changing the % sign to a $ sign and then removing {jose} in the print line I got it to work. I tested it in both Windows and Linux environments with the same results.
**************************************************************************** **************************** #! /usr/bin/perl -w open (INPUT, "<people.data"); $people = <INPUT>; close (INPUT); print "The value for jose is $people\n"; **************************************************************************** **************************** Hope this helps. Have a great day; Andy ----- Original Message ----- From: "Jose Malacara" <[EMAIL PROTECTED]> To: "Perl beginners" <[EMAIL PROTECTED]> Sent: Wednesday, August 14, 2002 12:35 AM Subject: open file into hash Hello. I was wondering if there was a way to open a file into a hash? I know this works for arrays, but was wondering if I this could be done for a hash also. I have a file called people.data, which contains two colums: jose 2 karen 8 jason 9 tracey 1 Can someone tell me what I am doing wrong here: ============================================= #! /usr/bin/perl -w open (INPUT, "<people.data"); %people = <INPUT>; close (INPUT); #%people = ( # "jose" => '2', # "karen" => '8', # "jason" => '9', # "tracey" => '1' #); print "The value for jose is $people{jose}\n"; ============================================= I expect to return the value of "2", but see the following error instead: "Use of uninitialized value in concatenation (.) or string at ./new.pl line 14. The value for jose is" I am guessing that this is related to opening the filehandle as it works if I declare the hash within the script (commented out above). Any help would be greatly appreciated. Jose -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]