metaperl has asked for the wisdom of the Perl Monks concerning the following question:
After the second use of the function it has1 => {}
1 => {}, 2 => {}
use Data::Dumper; use EDI::OrderStatus; use strict; sub collander_LoH { my $LoH = shift; my @ret; for (@$LoH) { my $key = keys %{$_}; my $val = $_->{$key}{'length'}; push @ret, { $key => $val }; } \@ret; } our $R = [ { client_number => { element => "Collectors Client Number (Co#) ", length => 2 , decimal => "n/a ", format => 3 , justify => "L ", fill => "Blanks " } } , { delete_code => { element => "Delete Code ", length => 1 , decimal => "n/a ", format => 4 , justify => "L ", fill => "Blanks " } } ]; for (1..3) { warn Data::Dumper->Dump([$R],['R']); collander_LoH $R; }
cctbrann@mcynote ~/SRC/modules/EDI/OrderStatus : perl coll.pl $R = [ { 'client_number' => { 'format' => 3, 'decimal' => 'n/a ', 'length' => 2, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Collectors Client Number ( +Co#) ' } }, { 'delete_code' => { 'format' => 4, 'decimal' => 'n/a ', 'length' => 1, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Delete Code + ' } } ]; $R = [ { 'client_number' => { 'format' => 3, 'decimal' => 'n/a ', 'length' => 2, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Collectors Client Number ( +Co#) ' }, '1' => {} }, { 'delete_code' => { 'format' => 4, 'decimal' => 'n/a ', 'length' => 1, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Delete Code + ' }, '1' => {} } ]; $R = [ { 'client_number' => { 'format' => 3, 'decimal' => 'n/a ', 'length' => 2, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Collectors Client Number ( +Co#) ' }, '1' => {}, '2' => {} }, { 'delete_code' => { 'format' => 4, 'decimal' => 'n/a ', 'length' => 1, 'justify' => 'L ', 'fill' => 'Blanks ', 'element' => 'Delete Code + ' }, '1' => {}, '2' => {} } ]; cctbrann@mcynote ~/SRC/modules/EDI/OrderStatus :
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LoH Incrementing Autovivification
by merlyn (Sage) on Nov 17, 2000 at 20:21 UTC | |
|
Re: LoH Incrementing Autovivification
by metaperl (Curate) on Nov 17, 2000 at 20:24 UTC | |
by Fastolfe (Vicar) on Nov 17, 2000 at 20:34 UTC |