rjsaulakh,
After spending a fair amount of time trying to explain this to you in the CB, I am going to recap before answering your question.

A hash key ($nas) is nothing more than a key and it has a corresponding value in the hash. That value may be a reference to another data structure (an anonymous hash). That anonymous hash may have one or more keys ($response_status). Your confusion is in thinking that there is only one possible value in the anonymous hash. In reality, it may have one or more keys. I would suggest the following code instead:

#!/usr/bin/perl use strict; use warnings; use constant STATUS => 0; use constant REQUEST => 1; # Some code that initializes %list # In the form # $list{ $nas }[STATUS] = $response_status; # $list{ $nas }[REQUEST] = $request_date_time # Later on you can retrieve the status and request like my $mac = ''; # actual code to get MAC from log my $status = $list{ $mac }[STATUS]; my $request = $list{ $mac }[REQUEST];
You may need to modify it a little if it is possible for a MAC to have more than one status and request date. If that is the case then you need to take some time in figuring out how to ask a question.

List of links added after initial post

Cheers - L~R


In reply to Re: How do I load a hash table? by Limbic~Region
in thread How do I load a hash table? by rjsaulakh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.