I used single-line Perl to create an SQL statement, but I cannot include single quotes.
This is what I want: first download and add quotation marks to it.
echo "a,b" | perl -F',' -lane 'print $F[0];' 'a'
I tried several different ways, but this did not work for me.
1.
echo "a,b" | perl -F',' -lane 'print qq('$F[0]');' [0]
2.
echo "a,b" | perl -F',' -lane 'print q('$F[0]');' [0]
Here is another interesting one.
It prints a single quote with a print statement, but if I assign a value to a variable and do not print it, it will not work.
perl -lwe "print q( i'am );" i'am perl -lwe "$b=q( didn't ); print $b"
Can you help me understand how we can use single and double quotes in single-line Perl?
source share