in reply to Re: Perl Bug?
in thread Perl Bug?

Corion: Kudos for solving that one! However, the code is straight out of the Perl Cookbook for implementing a SWITCH construct. Any suggestions for replacing foreach?

Replies are listed 'Best First'.
Re^3: Perl Bug?
by Corion (Patriarch) on Nov 22, 2005 at 12:13 UTC

    Please reread my reply. I already posted how you can remove the foreach which is unnecessary. As an alternative, you could use a different variable than $_ in your inner while-loop:

    while (defined (my $line = <PSTEST>)){ print "Line # ".$i."\n".$line; print "Platform now is '$PLATFORM'\n"; $i++; };
      Neat trick. I'll take it. Thanks!