in reply to Floats and numeric context

@stuff=($0.5,$0.5,$0.5) You're concatenating the value of the special variable $0 with 5. For the example you gave, this would fill @stuff with ('-e5', '-e5', '-e5'). Watch out for variable interpolation. perl -e "@stuff=('$0.5', '$0.5', '$0.5');my $x=0;foreach (@stuff){s/\$//; $x+=$_}; print $x" or perl -e "@stuff=qw($0.5 $0.5 $0.5);my $x=0;foreach (@stuff){s/\$//; $x+=$_}; print $x"

Replies are listed 'Best First'.
RE: Re: Floats and numeric context
by perlcgi (Hermit) on May 14, 2000 at 20:32 UTC
    I don't think so - have you missed the s/\$//; in the second one-liner?
    perlcgi
      No, you're right takshaka. Thanks man.
      (removed in deference to proper timeflow)