Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
so the shell gets invoked. I'm worried about the case where the filename contains characters " \ $ and so forth. (i.e., ones that have special meaning for the shell even when in double-quotes) - how do I protect from that? Would$x = `foo \"$filename\" | bar | baz`;
be foolproof? Is there a better alternative to using backticks in this situation?$filename =~ s/(["\\\$])/\\$1/g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: quoting for backticks
by Jaap (Curate) on Nov 01, 2002 at 10:36 UTC | |
|
Re: quoting for backticks
by Anonymous Monk on Nov 01, 2002 at 06:06 UTC | |
by Anonymous Monk on Nov 01, 2002 at 20:12 UTC |