Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Inserting data into a hash

by RazorbladeBidet (Friar)
on Apr 15, 2005 at 17:00 UTC ( #448262=note: print w/replies, xml ) Need Help??


in reply to Inserting data into a hash

Well, you're redefining your hash every time you are in the loop, so it's local to the loop. And you're also using a string "key" to be the key. What do you want to be the key? Uip? and the value to be Uuser? If so...
my $hash; while ($WOW =~ m!<table id=.*?table.*?<a href=.*?><b>(.*?)</b></a></sp +an>.*?\(from (.*?)\)!sim) { $Uip = $1; $Uuser = $2; $hash{$Uip} = $Uuser; ... } foreach my $key ( keys %hash ) { print "$key is Uip and $hash{$key} is Uuser\n"; }
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."

Replies are listed 'Best First'.
Re^2: Inserting data into a hash
by ghettofinger (Monk) on Apr 15, 2005 at 17:22 UTC
    I appreciate your help.
    Thank you very much.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2023-03-28 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (70 votes). Check out past polls.

    Notices?