How's that for a title? Anyway, for some reason, a function which I believe should not alter my LoH at all is adding entries to the individual hash refs. After the first use of the function, it adds:
1 => {}
After the second use of the function it has
1 => {}, 2 => {}

Code

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; }

Output (Note the added hash entries of the number N => {}, where N is an integer)

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 :

In reply to LoH Incrementing Autovivification by metaperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.