How to initialize an array of Strings in Perl?
Posted by Joys of Programming on in Perl
The simplest method to initialize a string in Perl is in the following manner
my @day = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
print $day[6];
which generates the following output
Saturday
If you notice carefully, each string is put in the quotes and separated by a comma
Comments:
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=42bdb4c7-4d70-4c00-b1ec-1f260452225f)