in reply to Re: Re: Where is my foreach data going to?
in thread Where is my foreach data going to?

Just one point , when using Data::Dumper::Dumper() to dump an array or a hash, it is often better to pass a reference to the hash/array, as the output looks more like the original data structure - and you avoid the copying overhead of call-by-value vs call-by-refernce
use Data::Dumper; my @array = (1,2,3,4,5,6,7); print Dumper(\@array); my %hash; # below is a hash slice - you should learn about these @hash{@array} = @array;# a hash whose keys == its values print Dumper(\%hash);
results in the output
$VAR1 = [ 1, 2, 3, 4, 5, 6, 7 ]; $VAR1 = { '7' => 7, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6 };
which to my eyes seems nicer

Replies are listed 'Best First'.
Re: Re: Re: Re: Where is my foreach data going to?
by demerphq (Chancellor) on Sep 18, 2003 at 11:34 UTC

    which to my eyes seems nicer

    And more accurate too. If the data structure was complex then the end result would be extremely confusing. Especially with Purity(1).


    ---
    demerphq

    <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...