Scott Walters phaedrus at
Thu Aug 2 15:02:16 CDT 2001

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...


More information about the Phoenix-pm mailing list