I enclose the code, it's better, but I don't understand where you suggest to use an hash

sub SubAcquisisciDatiCampiEsistenti { # Chiamata c +on in INPUT $file,@Databases restituisce \%result my $file= shift; my @Databases= @_; my %result; foreach my $Database (@Databases) { my $cmd1 = "adarep db=$Database fdt file=$file "; #print "\n\n $cmd1 \n\n"; my @ElencoDati= (); @ElencoDati = `$cmd1 |grep " 1 I "`; push (@ElencoDati, `$cmd1 |grep "SUPER"`); # my $ClearScr = `clear`; my @array1 = (); my @ElencoCampi = ""; foreach (@ElencoDati) { @array1 = split /\s+/, $_; push (@ElencoCampi, "$array1[3],$array1[5],$array1[7], +$array1[9]"); } shift (@ElencoCampi); @fields = sort (@ElencoCampi); chomp @fields; print "\n Elenco Campi Assegnati sul file $file del DB $Databa +se Ordinati \n"; foreach (@fields) { print "$_\n"; } print "\nL'ultimo campo utilizzato sul file $file del database + $Database e: ", $fields[$#fields],"\n\n\n"; my @Caratteri = split (//,$fields[$#fields]); print "\n"; my $PrimaLettera = ord $Caratteri[0]; print "Il valore numerico nella tabella ASCII della prima lett +era e: $PrimaLettera\n\n"; my $SecondaLettera = ord $Caratteri[1]; print "Il valore numerico nella tabella ASCII della seconda le +ttera e: $SecondaLettera\n\n"; print "\n\n"; if ( $SecondaLettera < 90 ) { $SecondaLettera+=1; push (@nextfield, chr($PrimaLettera).chr($SecondaLettera)) +; # print "\n\nIl prossimo campo disponibile e: $ProssimoCam +po\n\n"; } if ( $SecondaLettera == 90 ) { $PrimaLettera+=1; $SecondaLettera=65; push (@nextfield, chr($PrimaLettera).chr($SecondaLettera)) +; #$nextfield = chr($PrimaLettera).chr($SecondaLettera); # print "\n\nIl prossimo campo disponibile e: $ProssimoCam +po\n\n"; } print Dumper(\$Database,\@nextfield,\@fields); $result{$Database}{next}= \@nextfield; $result{$Database}{fields}= \@fields; } return \%result; }

outside this sub looping to re-print the result of the printing give me only the last fields of the last array two times


In reply to Re^8: Hash of Arrays or Arrays of arrays? and how proceed? by paride
in thread Hash of Arrays or Arrays of arrays? and how proceed? by paride

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.