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. | [reply] |
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.
| [reply] |
well with exception of the empty list! ;-)
DB<124> $x = ()
=> undef
Cheers Rolf
( addicted to the Perl Programming Language)
| [reply] [d/l] |