I've got a file that looks like this (using cat -vet to show tabs as ^I): [EMAIL PROTECTED]: $ cat -vet /tmp/PeopleFinderDepartments.txt 1^IH.07$ 2^IH.22$ 3^IH.30$ 4^IH.32$ 5^IH.32.01$ 6^IH.32.05$ 7^IH.32.06$ [EMAIL PROTECTED]: $
I want to write a script that will use these values to replace the numeric codes with the codes starting with "H..." If I read it using straight variables, it seems to work fine: [EMAIL PROTECTED]: $ perl -e 'open T, "/tmp/PeopleFinderDepartments.txt"; while (<T>) {chomp;($k, $h) = split(/\t/); print "$k-- $h:\n";}' 1-- H.07: 2-- H.22: 3-- H.30: 4-- H.32: 5-- H.32.01: 6-- H.32.05: 7-- H.32.06: [EMAIL PROTECTED]: $ If instead of $h, I want to assign it to a hash, $h{$k} for use later, it doesn't seem to work: [EMAIL PROTECTED]: $ perl -e 'open T, "/tmp/PeopleFinderDepartments.txt"; while (<T>) {chomp; ($k, $h{$k}) = split(/\t/); print "$k-- $h{$k}:\n";}' 1-- : 2-- : 3-- : 4-- : 5-- : 6-- : 7-- : [EMAIL PROTECTED]: $ What don't I understand about assigning values to a hash? What am I overlooking? Thanks in advance for your suggestions and advice. -Kevin Kevin Zembower Internet Services Group manager Center for Communication Programs Bloomberg School of Public Health Johns Hopkins University 111 Market Place, Suite 310 Baltimore, Maryland 21202 410-659-6139 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/