in reply to Re: Re: Re: sprintf and for loop weirds???
in thread sprintf and for loop weirds???

Looks like the perfect place for map.
my @b = map {sprintf("%.2f",$_)} @a;

Oh, you said obfuscated.... hows this for a first step down obfuscated lane:

my @b = split' ',sprintf" %.2f"x@a,@a;
one more step, and I'm done:
s;;sprintf" %.2f"x@a,@a;e;my@b=split;

-Blake

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: sprintf and for loop weirds???
by rob_au (Abbot) on Nov 04, 2001 at 17:30 UTC
    Yes, but you still use sprintf ...

    my@b=map{eval{$_=int$_*10**2;s;(..)$;\.$1;;return$_}}@a;

     

    Ooohhh, Rob no beer function well without!