vonedaddy has asked for the wisdom of the Perl Monks concerning the following question:
I am new to perl (first language so no programming background either) and need help solving a problem I am having. I am writing some code to check DNS records and I am stumped here. I an trying to create a hash from user input. Here is the code, for some reason I can not populate the hash (keys or values) using a variable. Any help is appreciated.
NOTE: print statements were for debugging :)
$count = 0; foreach (@rawdata) { #Remove newline if ($count == 0) { $key = $_; $count++; chomp $key; print "Key: $key<br>"; next; } if ($count == 1) { $value = $_; $count++; chomp $value; print "Value: $value<br><hr>"; } if ($count == 2) { $ipkey{'$key'} = '$value'; $count = 0; print $ipkey{$key}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating hash with variables
by bobf (Monsignor) on Feb 11, 2010 at 04:12 UTC | |
by vonedaddy (Initiate) on Feb 11, 2010 at 13:03 UTC | |
by Corion (Patriarch) on Feb 11, 2010 at 13:18 UTC | |
|
Re: Creating hash with variables
by Anonymous Monk on Feb 11, 2010 at 04:14 UTC | |
|
Re: Creating hash with variables
by dsheroh (Monsignor) on Feb 11, 2010 at 08:47 UTC | |
|
Re: Creating hash with variables
by hangon (Deacon) on Feb 11, 2010 at 14:57 UTC | |
|
Re: Creating hash with variables
by colwellj (Monk) on Feb 11, 2010 at 04:12 UTC | |
by colwellj (Monk) on Feb 11, 2010 at 04:19 UTC |