in reply to Data::Dumper style

Hi pg,

Im afraid you seem to have made an invalid assumption here:

print Dumper($hash); #which prints (\\d+), this really confused me

Dumper doesnt print (\\d+) it prints '(\\d+)' which is perfectly correct. Dumpers output (with any settings but Terse) is as merlyn pointed out meant to be evalled. This means that it emits valid perl statements to reconstruct the original data. So when it outputs a single quoted string it of course emits \\ instead of \ just as you used \\ inside of the doublequoted string when you assigned the value in the first place.

Short of emitting HERE docs as part of its output (which would be a PIA to read IMO) there is no way for it to specify a \ inside of a quoted construct except as \\. (Well, thats not strictly true. Dumper could be smarter about knowing which \ sequnces actually need to be doubled, but IMO the output would look even stranger, with some \ doubled and some not.)

The moral of the story is that Dumper does indeed get stuff wrong, but those things are rare indeed, and most of them are well known to the author and maintainers and to most of the more experienced members of the Perl community. It is unlikely that you will encounter a Dumper bug that isnt on this list. And incidentlly for the few things that do remain, they havent been fixed becuase currently it doesnt look like they are worth being fixed.

#are these the same or different? my ($x,$y); $x=\$y; $y=\$x; print Dumper([$x,$y]); my $ar=[]; $ar->[0]=\$ar->[1]; $ar->[1]=\$ar->[0]; print Dumper($ar);
HTH

--- demerphq
my friends call me, usually because I'm late....