J
Jamie Smyth
I have a hash defined as,
my %data = (
'wn_l' => $wn_l, 'wn_u' => $wn_u, 'wn_d' => $wn_d,
'npts' => $#spc+1, 'spc' => [@spc], 'label' => $label,
);
and I would like to extract the data in the @spc array. I tried,
my @spc = %data{'spc'};
and
my $spc = %data{'spc'};
but this results in the array being created directly in @spc[0]. I
ended up using:
my $d = $data{'spc'};
my @data = ();
push @data, @$d;
which gives me a 1dimensional array @data that I can use... the
problem is that I don't really know why this works and it looks a
little weird. Can someone explain?
Thanks.
my %data = (
'wn_l' => $wn_l, 'wn_u' => $wn_u, 'wn_d' => $wn_d,
'npts' => $#spc+1, 'spc' => [@spc], 'label' => $label,
);
and I would like to extract the data in the @spc array. I tried,
my @spc = %data{'spc'};
and
my $spc = %data{'spc'};
but this results in the array being created directly in @spc[0]. I
ended up using:
my $d = $data{'spc'};
my @data = ();
push @data, @$d;
which gives me a 1dimensional array @data that I can use... the
problem is that I don't really know why this works and it looks a
little weird. Can someone explain?
Thanks.