in reply to Perl one-liner Quotes help
It helps to mention which shell you're using if you us to help with its quoting mechanism. Looks like bash or similar.
You want bash to do
system( q{perl}, q{-lane}, q{print "John's";}, );
The first two parts are no-brainers since they contain no characters that are special to bash. Let's focus on the third.
print\ \"John\'s\";
"print \"John's\";"
'print "John'"'"'s";' 'print "John'\''s";'
perl -lane 'print "John'\''s";'
Note that the following is also acceptable to Perl:
system( q{perl}, q{-lane}.q{print "John's";}, );
That could be written as
but it looks better asperl '-laneprint "John'\''s";'
perl -lane'print "John'\''s";'
|
---|