in reply to Re: (jeffa) Re: When I try to create different objects i end up getting the same one over and over...
in thread When I try to create different objects i end up getting the same one over and over...
The resulting data structure is an array reference. This may not be what you want, however. Check this out (assuming your data file):
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. ;)$_->dump_os for @agents; # yields: $VAR1 = [ 'SUN', 'Solaris 8' ]; $VAR1 = [ 'IBM', 'AIX 4.3.3' ]; # etc.
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:
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!foreach (@agents) { $_->dump_os if grep /AIX/, @{$_->{os}}; }
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) 3Re: When I try to create different objects i end up getting the same one over and over...
by krujos (Curate) on Apr 26, 2002 at 20:17 UTC | |
by jeffa (Bishop) on Apr 26, 2002 at 21:53 UTC |