in reply to Re^3: foreach - adding newlines?
in thread foreach - adding newlines?
You can use *EVENT_ARRAY and *array rather than scalar names in the second anon. array argument to Data::Dumper->new() so that the arrays show up in the output as actual arrays and not array references. Like this
$ perl -MData::Dumper -e ' @arr1 = qw{ a b c }; @arr2 = qw{ 1 2 3 }; print Data::Dumper->new( [ $,, $", $\, $/, \ @arr1, \ @arr2 ], [ qw{ $, $" $\ $/ *arr1 *arr2 } ] )->Useqq( 1 )->Dump();' $, = undef; $" = " "; $\ = undef; $/ = "\n"; @arr1 = ( "a", "b", "c" ); @arr2 = ( 1, 2, 3 );
rather than this
$ perl -MData::Dumper -e ' @arr1 = qw{ a b c }; @arr2 = qw{ 1 2 3 }; print Data::Dumper->new( [ $,, $", $\, $/, \ @arr1, \ @arr2 ], [ qw{ $, $" $\ $/ $arr1 $arr2 } ] )->Useqq( 1 )->Dump();' $, = undef; $" = " "; $\ = undef; $/ = "\n"; $arr1 = [ "a", "b", "c" ]; $arr2 = [ 1, 2, 3 ]; $
I hope this is of interest.
Cheers,
JohnGG
|
|---|