in reply to Re: A simple backticks question
in thread A simple backticks question

Not fully correct, the backticks are context sensitive, in scalar context `ls -l` will return a concat of all lines. (a list array¹ in scalar context returns the number of lines)

backtick/qx in perlop

In scalar context, it comes back as a single (potentially multi- line) string, or undef if the command failed. In list context, returns a list of lines (however you’ve defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list if the command failed.

Cheers Rolf

( addicted to the Perl Programming Language)

updates

¹) corrected, thanks to no_slogan. It very much depends on what the command within backticks returns.

Replies are listed 'Best First'.
Re^3: A simple backticks question
by no_slogan (Deacon) on Mar 17, 2014 at 16:36 UTC
    Thanks for the correction, but again, not exactly correct. An array in scalar context evaluates to its number of elements. There is no such thing as a list in scalar context.
      well with exception of the empty list! ;-)

      DB<124> $x = () => undef

      Cheers Rolf

      ( addicted to the Perl Programming Language)