in reply to removing carriage returns
The problem is that single quotes don't convert things like \n, so you were printing everything except lines that contain a literal \, followed by a literal n.while ($requests = <REQUESTS>) { if ($requests ne "\n") { print MAIL "$requests"; } }
In the "there's more than one way to do it" tradition, you could just use the grep command.
The "empty line" regular expression will work because $ will match just before the \n.print MAIL grep !/^$/,<REQUESTS>;
You could also write your code using the "suffix" form of the condition.
orwhile ($requests = <REQUESTS>) { print MAIL $requests if $requests ne "\n"; }
Hope this helps!while ($requests = <REQUESTS>) { print MAIL $requests unless $requests=~/^$/; }
|
|---|