![]() |
|
"be consistent" | |
PerlMonks |
Re^3: Retunining hash values from subroutinesby packetstormer (Monk) |
on Jun 20, 2013 at 12:59 UTC ( #1039971=note: print w/replies, xml ) | Need Help?? |
This line:
%UID_PATH = ("$USER" => "$UID[5]")
creates a hash containing the values "$USER" => "$UID5". Where as this line: $UID_PATH{$USER} = "$UID[5]"; adds a value to the already exsiting hash. So, if you want to iterate through a file and perform some logic then add the result to an existing hash you use the second line. As long as the hash key is unique it will simple add to the hash leaving you with the end result of a hash with multiple values. Here is a really simple example.
In Section
Seekers of Perl Wisdom
|
|