>>>>> "SHC" == Shawn H Corey <[email protected]> writes:

  SHC> Soham Das wrote:
  >> a.. How do I initialise an array of a definite size with zero. Say the C 
equivalent of such a statement will be:
  >> int a[125];
  >> for(i=0;i<125;i++)                    a[i]=0;

  SHC> Not needed.  Perl assume zero if a non-existing element is used in an
  SHC> arithmetic expression.

  SHC> perl -e '$a[$_] += int(rand(10)) for 0..10;print"@a\n"'

only for ++/-- and +=/-= will that work with no warnings. if he uses an
undef value in another arithmetic expression it will warn.

uri

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to