Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: How do I load a hash table?

by edan (Curate)
on Jan 12, 2005 at 15:22 UTC ( #421632=note: print w/ replies, xml ) Need Help??

in reply to How do I load a hash table?

Maybe I'm totally misunderstanding you, but I'm envisioning that you have a HoH structure like this:

my %macs = ( '00:11:22:33:44:55' => { 'response_status' => 12, 'response_date' => 'yesterday', }, 'AA:BB:66:12:13:14' => { 'response_status' => 0, 'response_date' => '2004-12-31', }, # ... and so on );

And you get some user input, then you look up the data you want:

my $mac = <STDIN>; chomp $mac; if ( exists $macs{$mac} ) { print "Okay, found mac $mac:\n"; print "response_status: $macs{$mac}{response_status}\n"; print "response_date: $macs{$mac}{response_date}\n"; } else { print "Sorry, don't recognize that mac\n"; }

Is that what you meant?


Comment on Re: How do I load a hash table?
Select or Download Code
Replies are listed 'Best First'.
Re^2: How do I load a hash table?
by rjsaulakh (Beadle) on Jan 12, 2005 at 15:35 UTC
    yes edan i think ur an excellent guy that is what iwant store the mac address , it corresponding staus n response date. then take input from user check the mac id see if it is there , if it there then compare it status with "0" if successful i then want to print the mac , its status n date .. guide me

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2015-11-29 07:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (748 votes), past polls