That's only working because whatever's in $myvar1 and "\n" both happen to evaluate to 0 in a numeric context. You really meant eq; see perldoc perlop.
Update: Now if what you really mean is "is it a blank line with nothing but whitespace" you probably want $myvar1 =~ /^\s*$/
In reply to Re^3: How to test for a new line
by Fletch
in thread How to test for a new line
by BadMojo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |