in reply to Re: Re: Foreach Complications
in thread Foreach Complications

This is a followup to tilly's post, above. One place to look in this subroutine -- which is using globals -- is at your variables. The output suggests that the value set in a previous call to the sub is being re-used in subsequent calls. If you use my to declare those variables in the subroutine, this can't happen, and moreover, if anything goes wrong and you inadvertently assign undef to one of them, you'll get a warning (provided you turn on -w or use warnings. This will help you track down errors.

Installment #157145 in the 'we were really serious when we said "use strict and warnings" series' =)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Re: Re: Foreach Complications
by dws (Chancellor) on Dec 07, 2000 at 22:29 UTC
    arturo is correct. Look particularly at your use of (the same) $i and $id in the calling code and the subroutine.

    my is your friend.