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


in reply to Re: .vimrc for perl programmers
in thread .vimrc for perl programmers

Youll get more accurate results on self referential structures by using

warn Data::Dumper->Dump(sub{\@_}->(\@myarray), ['myarray'])

it doesnt make that much difference when the example is an array, but when its a scalar it does make a lot of difference.

Alternatively install Data::Dump::Streamer and get prettier, easier to read and more accurate dumps outright.

Yes, this is a shameless plug. :-)

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^3: .vimrc for perl programmers
by mreece (Friar) on Nov 01, 2006 at 17:11 UTC
    can you provide an example where this (undocumented?) syntax makes a difference?

      Looks like its been superficially improved so there is no difference anymore, which is good. But the output is still wrong, which is bad. For $x=\$y; $y=\$x; the raw call to Data::Dumper->Dump([$x,$y]) used to produce:

      $VAR1 = [ \\$VAR1->[0], ${$VAR1->[0]} ];

      But now it produces what Data::Dumper::Dumper (and what the sub{\@_} trick does) produce:

      $VAR1 = \\$VAR1; $VAR2 = ${$VAR1};

      Wheras Data::Dump::Streamer::Dump produces the correct output:

      $REF1 = \$REF2; $REF2 = \$REF1;

      Hope that explains things.

      ---
      $world=~s/war/peace/g