On May 27, 9:00 pm, [EMAIL PROTECTED] (Brian) wrote:
> Hi All-
>   I am trudging through some DBI, XML, etc.. I had a problem and was
> baffled by how to get at array elements out of a series of pushed
> array refs. But, by simplifying the problem, I found that the syntax I
> used was in error. here is the small sample, already debugged. Hope
> this helps someone...
>
> #!/usr/bin/perl
>
>         my @tRespsA;
>
>         my @fieldList = ( "one", "two", "three", "four" );
>         my @r1 = ( 1, 2, 3, 4 );
>         my @r2 = ( 13, 14, 15, 16 );
>         my @r3 = ( 23, 24, 25, 26 );
>
>         push @tRespsA, [EMAIL PROTECTED];
>         push @tRespsA, [EMAIL PROTECTED];
>         push @tRespsA, [EMAIL PROTECTED];
>
>         foreach my $tRowRef ( @tRespsA ) {
>                 my $tCnt=0;
>                 foreach my $tFld (@fieldList) {
>                         #if ( $tRowRef->[ $tCnt] eq "") { next; }
>                         print $tFld . "='" . $tRowRef->[ $tCnt++ ] . "' \r";
>                 }
>         }

 oh yes, more important than all that minutiae... the push did not
work for me in the working code. The array was being rewritten. I had
to use an array copy

  push @tRespsA, [ @r1 ];   ## copy contents to an anonymous array,
push array ref



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to