in reply to Hash Problem!

my %hash = ( 'main_data' => [ { 'LEVEL' => '12', 'CARNUM' => '1', 'REGIS#' => '1233456678987645RD ', 'ACCOUNT' => '6510334', 'YEAR' => '2008' }, { 'AMOUNT' => '200.00' }, { 'LEVEL' => '0', 'CARNUM' => '2', 'REGIS#' => '2234565478345R56T ', 'ACCOUNT' => '6510334', 'YEAR' => '2008' }, { 'AMOUNT' => '0.00' } ]); my @amounts = map { $_->{AMOUNT} } @{$hash{main_data}}; print "@amounts\n";

Replies are listed 'Best First'.
Re^2: Hash Problem!
by Anonymous Monk on Sep 30, 2008 at 13:41 UTC
    Would be possible to add the amount 'AMOUNT' => '200.00' to the first hash right after the 'LEVEL' => '12', because these values belong to the information above them, and they are separated making things more difficult.
      Sure it's possible. What have you tried so far? where have you had problems?