in reply to Data Structures
$Easting{$Line}{$Station}
That implies you intend to have 3 hashes, one for each of x, y & z. Parallel data structures are not (generally) a good idea as they can get out of sync and you're stuffed. Going by the line diagram, you'd be better off with something that allowed you to do:
my %line = ( lineNameA => { StationA => [ xxx.xx, yyy.yy, zzz.zz ], StationB => [ xxx.xx, yyy.yy, zzz.zz ], ... }, lineNameB => { ... ); my( $x, $y, $z ) = $line{ $lineName }{ $stationName }; # Or use constant{ X => 0, Y => 1, Z => 2 }; my $y = $line[ $lineNo ][ $staionNo ][ Y ];
That's assuming the the identifiers are names not numbers.
If they are numbers, or names of the form "line_003" and "station_12", (low, mostly sequential number postfixes ),
then you'd save some memory and be a tad quicker to use arrays instead of hashes:
my @line = ( [ ## $line[ 0 ] [ xxx.xxx, yyy.yyy, zzz.zzz ], ## $line[0][0] (station 0) [ xxx.xxx, yyy.yyy, zzz.zzz ], ## (station 1) [ xxx.xxx, yyy.yyy, zzz.zzz ], ... ], [ ## Line[ 1 ] [ xxx.xxx, yyy.yyy, zzz.zzz ], ## Line[ 1 ][ 0 ] [ xxx.xxx, yyy.yyy, zzz.zzz ], [ xxx.xxx, yyy.yyy, zzz.zzz ], ... ], ... ); my( $x, $y, $z ) = $line[ $lineNo ][ $stationNo ]; # Or use constant{ X => 0, Y => 1, Z => 2 }; my $y = $line[ $lineNo ][ $staionNo ][ Y ];
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom