I thought about why you chose a hash and didn't see the benefit. I guess i need to see your requirements first before making that judgement, but again, my point was to show you how to get the most out of Perl - how to break away from C-style coding.

The resulting data structure is an array reference. This may not be what you want, however. Check this out (assuming your data file):

$_->dump_os for @agents; # yields: $VAR1 = [ 'SUN', 'Solaris 8' ]; $VAR1 = [ 'IBM', 'AIX 4.3.3' ]; # etc.
Again, since i really do not know what your target is, i had to improvise. Now is the time when i wish i could be at your computer ... but alas ... if you want to continue this disussion, let's work via /msg and scratchpad's - no need to waste database space. ;)

UPDATE:
After some discussion via /msg's, i feel that storing the os's in a hash is not necessary at all. If you store them in an array reference as i have done, you can test for a particular OS by using grep. Here is an example:

foreach (@agents) { $_->dump_os if grep /AIX/, @{$_->{os}}; }
Of course, you could also grep a hash, but that seems a bit like using a square on a round hole to me. ;) Good luck!

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) 3Re: When I try to create different objects i end up getting the same one over and over... by jeffa
in thread When I try to create different objects i end up getting the same one over and over... by krujos

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.