manishrathi has asked for the wisdom of the Perl Monks concerning the following question:
@trial_array = ("first", "second", "third");
$sec_el = $trial_array[1];
"this is a data file. This ie read in array. this is looped through"
now each line becomes an element of @data_array. so there are three elements $data_array[0], $data_array[1] and $data_array[2] in @data_array.$datafile = datacapture.cgi; open(DAT, $datafile); @data_array = <DAT>;
does it mean that $loopvariable will be assigned the elelments of @data_array one by one ? or do I need to use $data_array[] directly ?foreach $loopvariable (@data_array) { print $loopvariabe ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: looping through array
by kennethk (Abbot) on Jan 07, 2010 at 21:48 UTC | |
|
Re: looping through array
by biohisham (Priest) on Jan 07, 2010 at 22:27 UTC | |
by manishrathi (Beadle) on Jan 07, 2010 at 23:24 UTC | |
by AnomalousMonk (Archbishop) on Jan 08, 2010 at 02:50 UTC | |
by manishrathi (Beadle) on Jan 08, 2010 at 00:16 UTC | |
by AnomalousMonk (Archbishop) on Jan 08, 2010 at 03:07 UTC | |
|
Re: looping through array
by AnomalousMonk (Archbishop) on Jan 07, 2010 at 23:07 UTC |