use CGI; print 'Your input: '; my $var = <STDIN>; chomp $var; print "\$var is '$var'"; # Output: 'var is 'foo
What's happening here? I can work around the problem by changing the chomp line to:
$var =~s/\s+$//; # Output (as expected): $var is 'foo'
I also have no problem when the scalar doesn't come from STDIN, eg:
chomp ( my $var = "foo\n" );ActiveState perl v5.8.8 (build 819) on WinXP Pro, CGI.pm version 3.20.
In reply to CGI, STDIN and chomp problem: bug? by Not_a_Number
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |