Pedro Antonio Reche wrote:

> Dear all,
> I have a table that has exponential numbers of the type 0.203E-2 and I
> will like to reformat getting rid off the exponential so that the
> previous number would look when printed as 0.00203.
> Is there any easy way to do this?
> Any help welcome.

brain dead approach:

#!/usr/bin/perl -w
use strict;

for(qw~ 0.203E-2    0.203E+9 0.203e-9
        0.20233E-12 0.123e+3 3435E+15 ~){

        /(\d+)E(.)(\d+)/i;

        my $l = $2 eq '+' ? 0 : length($1) + $3;

        printf('%20s'. '%.' . $l . "f\n","$_ becomes ",$_);
}

__END__

prints:

   0.203E-2 becomes 0.00203
   0.203E+9 becomes 203000000
   0.203e-9 becomes 0.000000000203
0.20233E-12 becomes 0.00000000000020233
   0.123e+3 becomes 123
   3435E+15 becomes 3435000000000000000

perldoc -f sprintf
perldoc -f printf

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$";
map{~$_&1&&{$,<<=1,[EMAIL PROTECTED]||3])=>~}}0..s~.~~g-1;*_=*#,

goto=>print+eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to