Thanks alot to everyone.
I think I understand now, why it's wrong to use "my" within the foreach loop.
Just for your information: I'm currently trying to learn Perl by reading the Llama book (Learning Perl). The question is about my solution to one of the exercises within the book. Don't wonder about my @words = <STDIN> because including the current chapter the author always works in this way. End of input is reached by hitting Ctrl+D. This is until we reach a future chapter where he probably tells us how to solve it in a better way. I assume it might be this "split" solution which I have already seen.
btw. concerning use diagnostics;. I already knew about it, but it wasn't very helpful in this case.
In reply to Re: Syntax error - "my" within foreach loop
by Klammer
in thread Syntax error - "my" within foreach loop
by Klammer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |