Linux.com

Re:Oh Dear, lets look at arrays again

Posted by: Administrator on July 08, 2004 12:39 AM
This is exactly why I advocate using the range operator to iterate over an array's indexes. Not only is it easier to type and understand, it's less prone to off-by-one errors:
<TT>for $i (0<nobr> <wbr></nobr>.. $#array) {
    print "$array[$i]\n";
}</TT>

#

Return to SysAdmin to SysAdmin: Approaching Perl