in reply to Re: 'prev' in for loop
in thread 'prev' in for loop

hi,
I updated my question too.if my loop supports  next if($_ eq 'foo') then, why not it's support  prev if($_ eq 'foo')?
-kulls

Replies are listed 'Best First'.
Re^3: 'prev' in for loop
by phaylon (Curate) on Dec 07, 2005 at 13:34 UTC
    Because that's how Perl was designed. It would IMO be more confusing than supportive to the programmer. Also, like Perl Mouse said, last and next don't influence the loops position (directly), more the control flow. 'last' exits the block, so the calling run was the /last/ one. 'next' jumps to the end of the block so the /next/ run will start if there is any. 'redo' redoes the block without going to the next iteration.

    Ordinary morality is for ordinary people. -- Aleister Crowley