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?
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++;
};