Phoenix.pm: Math
EdelSys Consulting
edelweiss at qwest.net
Thu Aug 2 23:51:00 CDT 2001
That quote was from an Austin Powers movie. Scott Evil
was Doctor Evil's son. Hope you didn't take it amiss, Scott. =)
Tony
At 04:02 PM 8/2/01 -0400, you wrote:
>
>Ok, folks, sorry for spam... last post for today.
>
>package StupidFloat;
>use Exporter;
>@EXPORT = qw(stupidfloat);
>
>sub stupidfloat {
> my $nombre = shift;
> my $value = 0.0;
> (my $callerpackage) = caller;
> *{$callerpackage.'::'.$nombre} = sub () : lvalue {
> $value = substr($value, 0, 14);
> };
> eval("package $callerpackage;\nsub $nombre ();\n");
>}
>
>package Work;
># use StupidFloat; # have to write a bloomin file for this
>StupidFloat::stupidfloat result;
>result = (0.07 * 10000.0);
>printf "%40.35f\n", result;
>
>
>... cleaner. Just evals up a prototype for the function/variable
>as it creates it so you can use it like a bareword. Which is how
>scalars should be, IMHO. Bet Larry Wall ever expected to see people
>assigning data to barewords...
>
>-s
>
>
>
>
More information about the Phoenix-pm
mailing list