Gossamer Forum
Home : General : Perl Programming :

Data::Dumper

Quote Reply
Data::Dumper
I've used Data::Dumper quite a few times and this is the first time I've experienced this...not sure what is going on...ugh.

Basically when I dump the following:

$VAR = { 'key_name' => [1,2,3,4,5] };

..it gets printed as:

Code:
$VAR = { 'key_name' => [
'1' ,
'2' ,
'3' ,
'4' ,
'5'
]
};

That looks fine but for some reason when I do() the file all the values in the arrayref have (I think) a new line after them.

If I edit the file so it looks like:

$VAR = { 'key_name' => [1,2,3,4,5] };

...again, the new line disappears. I don't get it. It's not even like the single quotes drop onto a new line like:

[ '1
',
'2
',

...so I don't know where the new line is coming from....(or space).....but it is causing me grief.

Last edited by:

Paul: Jun 29, 2002, 7:19 AM
Quote Reply
Re: [Paul] Data::Dumper In reply to
Shock horror, it was my fault...

I was using:

$TMP->{pm_pp_values} = [ split /\n+/, $input->{pm_pp_values} ];

...and needed...

$TMP->{pm_pp_values} = [ split /[\r\n]+/, $input->{pm_pp_values} ];

Last edited by:

Paul: Jun 29, 2002, 7:20 AM