Demonstrating the .. operator : Range « Statement « Perl
- Perl
- Statement
- Range
Demonstrating the .. operator
@array2 = ( 1 .. 5 );
print "Value\tRunning Total\n";
for ( $i = 0; $i < 5; ++$i ) {
$total += $array2[ $i ];
print( $array2[ $i ], "\t$total\n");
}
@array2 = ( 'a' .. 'z' );
print "\n@array2\n";
Related examples in the same category