Insert a newline in a perl -e statement

bashcommand linekeymapnewlinesperl

Consider the following Perl one-liner:

perl -e '$x; $y;'

I'm executing this command in bash and I'd like to insert a newline (\n) between the ; and $y. I'd like to know how to do this in two similar but slightly different ways:

  1. How can I insert the newline in that position by pressing some meta key sequence to insert the newline?

  2. How can I insert the newline in that position by typing some non-meta character sequence? (eg, '$x;\n$y;')

In both situations I want the Perl interpreter to see an actual newline, like this:

$x;
$y;

Best Answer

Delete the space, then type CtrlV, CtrlJ.
Then Return.

The Ctrl-V prevents the shell interpreting the next character (newline) literally.