in reply to help regarding command line arguments
When you use "\n" in a string in your script, perl converts the "\n" into the newline character. But you don't want perl to automatically do that in data, 'cause sometimes you really want the characters "\" and "n". When you pass data into your script, perl assumes the data is what you want, so it doesn't touch it.
So if you want the "\n" converted into a newline, just tell perl to do the conversion for you, like so:
use strict; use threads; my $t = shift; my $u = $t; $u =~ s/\\n/\n/g; print "<$t>\n\n<$u>\n";
Which gives me this when I run it:
$ perl zoop.pl "foo\nbar\n\n\nbaz" <foo\nbar\n\n\nbaz> <foo bar baz>
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|