开发者

basic perl, command prompt question: how to enter the next command after returning "perl" accidentally

this may sound incredibly nai开发者_C百科ve and stupid, i'm new to programming

in command prompt after returning perl alone without any command, i'm not able to enter the next command. i'm struck there

i mean C:\users\sam>perl

how do i get to "C:\users\sam>" again its very frustrating thanks


Ctrl+c (interrupt).

Or, on Windows, Ctrl+z followed by Enter (EOF).

Or, on UNIX (including Linux and OS X), Ctrl+d (EOF), Ctrl+\ (quit), or Ctrl+z followed by the kill % command.


perl by itself will start the interpreter and then wait for the program to come in via STDIN. Ctrl+c will interrupt the interpreter and it will then quit.

To enter a short program via STDIN at the command line that does the same as perl -e 'print "hello, world"' (on Windows flip the quotes around: perl -e "print 'hello, world'"):

> perl
print "hello, world!";
^D
hello, world!
>

^D is a notation for Ctrl+d which signifies the end of the input stream. Be sure to press Enter after Ctrl+d, since Perl uses line buffered input.


Type __END__ on a line of its own.

Or BEGIN{exit}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜