Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: structuring data: aka walk first, grok later

by pc88mxer (Vicar)
on May 30, 2008 at 16:25 UTC ( #689269=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $DATA_X;
    my $DATA_Y;
    ...
      push(@{$DATA_X->{$obs}->{$det}}, $x);
      push(@{$DATA_Y->{$obs}->{$det}}, $y);
    }
    
  2. or download this
    my $DATA;
    while (<>) {
      my ($obs, $det, $x, $y) = split(' ', $_);
      push(@{$DATA->{$obs}->{$det}}, {x => $x, y => $y});
    }
    
  3. or download this
    print $DATA->{21}->{'DET-2'}->[0]->{x}; # prints 896.657564735788
    print $DATA->{47}->{'DET-7'}->[1]->{y}; # prints 519.649226713148
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://689269]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-07-23 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (465 votes). Check out past polls.

    Notices?