in reply to RE: simple!!
in thread simple!!

Just to take it farther... to undo this, you could:

s/([\.\d]+)e\(?([-+]?\d+)\)?/$1*10**$2/egi;

I would rather have the notation given as 1.2234e+2, simply because Perl sees that as a number. By that I mean if you:

my $foo = 1.2234e(+2);

Perl will complain. If you do the following, it won't:

my $foo = 1.2234e+2;

The above RE should handle both cases. This is fun though..

$_=sprintf("%#1.4e",122.34); print; s/([\.\d]+)e\(?([-+]?\d+)\)?/$1*10**$2/egi; print $/; print;

Cheers,
KM

Replies are listed 'Best First'.
RE: RE: RE: simple!!
by t0mas (Priest) on Aug 19, 2000 at 22:26 UTC
    A very nice undo regexp there...

    I agree with you KM that 1.2234e+2 is a better format for keeping and operations, but for printing (as I believe vnpandey wanted) I rather use the format that pays my bills :)


    /brother t0mas