Date sent:              Mon, 28 Sep 2009 09:11:02 -0700
Subject:                Re: Arrays, Dates, Indexing and Initialisation
From:                   r...@i.frys.com
To:                     "Soham Das" <soham...@yahoo.co.in>
Copies to:              beginners@perl.org

> Soham Das wrote:
> > Hello All,
> >
> > I wanted some guidance with these questions of mine:
> >
> > 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;
> >
> my @array;
> $array[$_] = 0 for 0..125;

my @array = (0) x 126;

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
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