[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Add to elements of a list



  To test the code, feed this to perl -e :

  'sub f{(1,2,3)};($x,$y,$z)=(5,1,0);eval join ";",map { "$1 += $_" if "\$x \$y \$z" =~ m/(\S+)/g } f();print "$x,$y,$z\n"'

  and 

  'sub f{(1,2,3)};($x,$y,$z)=(5,1,0);eval(sprintf("\$x+=%f;\$y+=%f;\$z+=%f;",f()));print "$x,$y,$z\n"'

  In both cases, the output is "6,3,3" as it should.

  Etienne

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe