in reply to Extract numbers in multiple bases
Ugly, but probably 'rock-solid', no esoteric modules and should work with any perl.my $str = "123e4"; print asNum( $str ); sub asNum { my $str = shift; my $foo; eval "\$foo = $str"; # backslash for string not reference if( $@ ) { warn( "oops : $@" ); } return $str; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Extract numbers in multiple bases
by tachyon (Chancellor) on Oct 30, 2001 at 18:25 UTC |