in reply to Backtics execution with multiple lines

It's not the backticks that interpret it as two commands, but your shell. This works for me:
$ cat foo.pl print ` echo foo \\ bar`; $ perl foo.pl foo bar

Replies are listed 'Best First'.
Re^2: Backtics execution with multiple lines
by ivanatora (Sexton) on Feb 04, 2009 at 18:10 UTC
    That's curious, becouse I can do command line splitting with "\" in my shell.
    And here backticks are not working:
    $ cat backticks.pl #!/usr/bin/perl `ls \ -l *.pl`; $ perl backticks.pl sh: line 1: -l: command not found
      You're not passing a slash to the shell. Backticks are like "". If you want the resulting string to contain a slash, you need to escape it.
      $ perl -le'print "foo bar"' foo bar $ perl -le'print "foo\ bar"' foo bar $ perl -le'print "foo\\ bar"' foo\ bar