>>>>> "Brett" == Brett W McCoy <[EMAIL PROTECTED]> writes:
Brett> On Wed, 20 Jun 2001, Nick Transier wrote:
>> You are saying I cannot set the size of an array? I understand that you do
>> not have to, but I need to in this case so that my iteration loops work
>> correctly.
Brett> No you don't:
Brett> foreach $i (0..@array) {
Brett> print "$array[$i]\n";
Brett> }
Brett> @array used in a scalar context gives you the size of the array, or you
Brett> can explicitly put it into a scalar context using the scalar function.
Except you just invoked a fencepost error. ("How many fenceposts does
it take to put up a 100-foot fence if you put them every foot?") You
want to go up to $#array.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!