output#!/usr/bin/perl -w use strict; my @array=qw (5 4 10); my $sum=0; my $str="("; foreach my $num(@array) { my $temp=$sum + 1; $sum=$sum+$num; $str=$str."$temp-$sum,"; } chop($str); $str=$str.")"; print "$str\n";
(1-5,6-9,10-19)
In reply to Re: Printing the elements of array
by ansh batra
in thread Printing the elements of array
by viktor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |