On Sa. 27. Dez. 2008, 02:40:54, grian wrote:
> [Please enter your report here]
>
> $ perl -MData::Dumper -e'print Dumper(1.0)'
> $VAR1 = '1';
> must be:
> $VAR1 = 1;
>
> ===Note single quotes===
>
Is this really a bug?
I know that the behaviour differs with Dumper.xs and Dumper.pm.
This is current behaviour:
C:\>perl -MData::Dumper -e "print Dumper 1.0"
$VAR1 = '1';
C:\>perl -MData::Dumper -e "print Dumper 1.01"
$VAR1 = '1.01';
C:\>perl -MData::Dumper -e "$Data::Dumper::Useperl=1; print Dumper 1.01"
$VAR1 = '1.01';
C:\>perl -MData::Dumper -e "$Data::Dumper::Useperl=1; print Dumper 1.0"
$VAR1 = 1;
C:\>perl -MData::Dumper -e "$Data::Dumper::Useperl=1; print Dumper
123456789.0"
$VAR1 = 123456789;
C:\>perl -MData::Dumper -e "$Data::Dumper::Useperl=1; print Dumper
1234567890.0"
$VAR1 = '1234567890';
You can see that even with the Perl implementation of Dumper it uses
single quotes if the number has more than 9 digits. This is due to this
line:
elsif ($val =~ /^(?:0|-?[1-9]\d{0,8})\z/) { # safe decimal number
$out .= $val;
}
If you want to get rid of the single quotes for decimals that ends with
".0" you have to remove the differentiation of Perl < 5.6 and Perl > 5.6
for the "DD_is_integer" definition in Dumper.xs.
Thread Previous
|
Thread Next