in reply to Re: Syntax error - "my" within foreach loop
in thread Syntax error - "my" within foreach loop

has no control mechanism to terminate the input
^D worked for me :)

Replies are listed 'Best First'.
Re^3: Syntax error - "my" within foreach loop
by ww (Archbishop) on Apr 14, 2008 at 00:30 UTC
    True, but better for the student to learn the importance of prompting the user clearly, and explicitly... AND to learn first to code using explicit constructs, rather than relying on implicit (and OS-dependant) ones.

    For example, lusers could still screw this up, but at least the program's author would have tried:

    ... print "Type a series of words, separated by spaces, ending with a retu +rn:\n"; my $words = <STDIN>; chomp $words; my @words = split (/ /, $words); ...