in reply to making dumper to align perfectly

If by "align" you mean "insert a number of spaces (or a tab) at the start of each line", you're half-way there already
my $d = Dumper $hash;; $d =~ s/^/\t/gm; print $d; # now indented
Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: making dumper to align perfectly
by Anonymous Monk on Oct 14, 2009 at 13:23 UTC
    There is an improvement in the alignment, but i dont know how to get as i expected. It gives this output,
    My hash-> $VAR1 = { 'a' => '1', 'b' => [ 1, 2 ] };
    But i would want, ( as said in the previous reply ).
      Then you need to insert more spaces. It's not hard to get from my suggestion to what you want. Show some effort.
      Perl 6 - links to (nearly) everything that is Perl 6.
      You just don't bother trying to adapt solutions given to you.
      my $d = Dumper $hash; my $somanyspaces = ' 'x10; # how long is your string? # add to all lines whitespaces $d =~ s/^/$somanyspaces/gm; # add to first line your string $d =~ s/^$somanyspaces/I am lazy /; print $d; # now indented