>>>>> "JH" == Jugurtha Hadjar <jugurtha.had...@gmail.com> writes:

  JH> Hello,
  JH> On 12/24/2010 06:45 PM, Uri Guttman wrote:
  >>>>>>> "JH" == Jugurtha Hadjar<jugurtha.had...@gmail.com>  writes:
  >> 
  JH> my @data   =0;
  JH> my @fields =0;
  JH> my @val    =0;
  >> 
  >> that has to be wrong. that is setting the arrays to a list with the
  >> element 0, not an empty list.

  JH> Exactly. I tried to do something like

  JH> my @data = (0, 0, 0, 0, 0);

  JH> It's not even fun to write, and it didn't make sens at all so it had
  JH> to be wrong .. What if it was a list of 100 ? I just killed it to my
  JH> @data= 0;

my @data = (0) x 100 ;

learn more about perl ops and you will find most of what you REALLY want
is in there.


  JH> But as you and Shawn H Corey pointed out, an empty list was the
  JH> thing to do.

that is correct in this case. initializing an array to actual elements
is not needed that often. but when it is, know how to do it properly.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to