On Friday, October 17, 2003, at 10:13 AM, 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?

I like:


for (my $i = 1; $i < @list; $i++) {          # skipping index 0
        # in here, current is $list[$i]
        # and previous is $list[ $i - 1 ]
}

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to