in reply to Hashing multiple items
I suspect that you really want to store the coordinates as a four-element array as opposed to a 4-dimension array. The following might serve as an executable example of what you want:
use strict; use Data::Dumper; my %zones; while (<DATA>) { chomp; my ($zone, $a1, $a2, $b1, $b2) = $_ =~ /(\w+) = (\d+),(\d+),(\d+),(\d+)/; #append an anonymous (coordinate) array on to the #anonymouse array that is the value for each hash #key in %zones hash. push @{$zones{$zone}}, [$a1, $a2, $b1, $b2]; } print Dumper(%zones); __DATA__ B1 = 11,21,3,59 B2 = 1,23,7,51 B1 = 9,2,11,9 B2 = 1,23,7,59 B3 = 3,92,12,13 B1 = 2,2,18,50
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hashing multiple items
by Anonymous Monk on Nov 15, 2003 at 18:49 UTC |