in reply to command line and quotes

You don't get that kind of information in your program - the shell takes it away before your program runs.

Since your primary concern is passing the arguments on correcty, why not do:

@ARGV = map { quotemeta($_) } @ARGV; print "@ARGV"; __OUTPUT__ > perl test.pl -s "1 2 3" \-s 1\ 2\ 3
This depends on whether quotemeta does the kind of escaping you need, but it seems to be a reasonable start.

Replies are listed 'Best First'.
Re^2: command line and quotes
by ambrus (Abbot) on Jun 02, 2006 at 11:38 UTC

    For bash-like shells, quotemeta doesn't do the correct escaping, as it turns a newline to a backslash-newline pair, which bash will unescape to an empty string.