2

I'm parsing a file that contains few numbers noted as 2.4E+04.

I found the module Data::Str2Num that fits on my needs unfortunately Activeperl doesn't have it compiled to 5.16, only for 5.8 and I'm bounded to use 5.16 from Activeperl as it is the exact same version for production (I cannot use anything outside the ppm).

Is there any module like Data::Str2Num that does the same in the newer versions?

UPDATE:

Inside a script you can do my $value = "2.4E+04" + 0;

1 Answer 1

5

Evaluate it in a numeric context:

perl -e 'print "2.4E+04" + 0;'
24000
1
  • Thanks! I just tested and really works, just need to add, Doh!
    – user491135
    Nov 7, 2013 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.