in reply to Add Hash Key Based on Matching Another Key
my %macs; foreach @aps { $macs{$_->{'ap_MAC'}}=$_; }
then your loop is reduced to this:
$macs{"00:00:00:00:00:00"}{'serial'} = "FTX12345678";
If you often need to know the array index too, you might store the index number as value into the hash instead of the pointer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add Hash Key Based on Matching Another Key
by spickles (Scribe) on Jul 28, 2010 at 15:51 UTC |