http://qs321.pair.com?node_id=11124896


in reply to Printing first element of an array in worksheet

Look at this line:

@redi = $responsetextall[$i][$j]{set}{Client}{redirect_uris}

What does $responsetextall[$i][$j]{set}{Client}{redirect_uris} contain? Does it contain an array reference? You are assigning that array reference to @redi so that @redi contains:

@redi = ( [....], );

It contains a single element. That element is a reference to an array. You should have done one of two things. Either this:

@redi = @{$responsetextall[$i][$j]{set}{Client}{redirect_uris}}

...or this:

$redi = $responsetextall[$i][$j]{set}{Client}{redirect_uris} # and then... for my $i (0..$#$redi) { $worksheet->write($r, 6, [$redi->[$i]]); }

The first one is an easier change, the second one is a little more memory efficient.

See perlreftut, and perllol, perhaps.


Dave