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;

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

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


b. Is it possible, to have dates as index? I am trying to parse and process
data corresponding to a list of "trades" I have made(financial trades) and
want to see, how my portfolio varies with time. So is it possible to do in
such a way?



Perl has no date type. All dates are either strings or numbers. You can use any string as the keys to a hash. Numbers would be convert to strings if they are used as keys.


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

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