aboutsummaryrefslogtreecommitdiff
path: root/Perl/Zinc/TraceUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Perl/Zinc/TraceUtils.pm')
-rw-r--r--Perl/Zinc/TraceUtils.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/Perl/Zinc/TraceUtils.pm b/Perl/Zinc/TraceUtils.pm
index 8a3bc76..95327ce 100644
--- a/Perl/Zinc/TraceUtils.pm
+++ b/Perl/Zinc/TraceUtils.pm
@@ -42,11 +42,16 @@ sub Item {
return "'$value'";
} elsif ($ref eq '') { # scalar
if (defined $value) {
- if ($value =~ /^-?\d+(\.\d*(e[+-]?\d+)?)?$/ or # -1. or 1.0
- $value =~ /^-[a-zA-Z]([\w])*$/ # -option1 or -option-1
- ) {
- return $value;
- } elsif ($value eq ''
+ if ($value =~ /^-[a-zA-Z]([\w])*$/) { # -option1 or -option-1
+ return $value;
+ } elsif ($value =~ /^-?\d+(\.\d*(e[+-]?\d+)?)?$/) { # -1. or 1.0 or -1.2e+22 or 1.02e+034
+ if ($value =~ /(.*[-+]e)0+(\d+)/) { # removing the 0 after e+ or e-
+ return $1.$2;
+ } else {
+ return $value;
+ }
+ }
+ } elsif ($value eq ''
or $value =~ /\s/
or $value =~ /^[a-zA-Z]/
or $value =~ /^[\W]/