SPUG: Rebuked...

Stuart Poulin stuart_poulin at yahoo.com
Tue Jan 4 18:02:26 CST 2000



--- Ken McGlothlen <mcglk at serv.net> wrote:
> > 
> Well, if you wanted to process each of these in a list, and return a list of
> values, you'd write something like:
> 
> 	sub Cur {
> 	    my( @ix ) = ();
> 	    foreach( @_ ) {
> 		$_ = sprintf( "%.2f", $_ );
> 		1 while s/(.*\d)(\d\d\d)/$1,$2/g;
> 		push( @ix, "\$$_" );
> 	    }
> 	    return( @ix );
> 	}
> 
> 

But watch out for those references in for loops and @_.
Try:  @foo = (123.321, 212312.34221, 34234234.342);
      Cur(@foo);
      print "@foo\n";
(But maybe you wanted this behavior)

Signed: One who's been bit by this many times.
 

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://messenger.yahoo.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list