Nandita Mullapudi wrote:
>
> I have a list of elements- and for every element in the
> list, I want to carry out an operation with the previous
> element or the next one, as the case might be, how do I tell
> perl to look at the previous element?
Ni Nandita.
This isn't straightforward in Perl.
How about something like the program below?
HTH,
Rob
use strict;
use warnings;
my @list = 1 .. 20;
while (my $i = shift(@list), @list) {
my $j = $list[0];
printf"%2d %2d\n", $i, $j;
}
**OUTPUT**
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]