in reply to Re: Unix shell ls vs readdir
in thread Unix shell ls vs readdir

it might be safer to use "\ls -l" instead

Under almost all circumstances, the backslash would not be needed.  On the interactive command line, the backslash prevents alias expansion (such as "ls" —> "ls --color=auto", which then produces the ANSI escape sequences), because alias lookup happens before backslash escapes are processed, and there is no alias for "\ls".

However,

  1. alias expansion is only done for interactive shells, and not for sh -c ... (i.e. qx{...} ) — unless explicitly requested otherwise,
  2. alias expansion would be done by the shell, but unless there are any shell metacharacters in the command, no shell is involved anyway, as Perl will run ls directly.

Replies are listed 'Best First'.
Re^3: Unix shell ls vs readdir
by stefbv (Priest) on May 11, 2010 at 08:07 UTC

    True. I tend to forget that the shell is not involved.