Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re:by periapt (Hermit) |
on Jun 17, 2004 at 11:59 UTC ( [id://367586]=note: print w/replies, xml ) | Need Help?? |
There are a couple of issues with your code In your first while loop, you have a bareword sp where you meant $sp. The effect of this would be to assign only one value to each key in the file. Second and subsequent values for a key would be assigned to $p2i{sp}. In your first foreach loop you try to print the value of $p2i{$key} which is simply a reference to the array you have stored the values in. You have to dereference this value into an array with @{$p2i{$key}} You have some duplicative code in your if(exists...) loop. You can print the values of the array in $p2i{$user} with the simple foreach loop. For more information on references, take a look at perldoc -m perlreftut and perldoc -m perlref
PJ We are drowning in information and starving for knowledge - Rutherford D. Rogers
|
|
---|
Log In? |
---|
Domain Nodelet? |
Node Status? |
node history Node Type: note [id://367586] help |
Chatterbox? |
How do I use this? • Last hour • Other CB clients |
Other Users? |
Others having a coffee break in the Monastery: (4) As of 2024-04-19 05:41 GMT |
Sections? |
Information? |
Find Nodes? |
Leftovers? |
|
Voting Booth? |
No recent polls found |