Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl: Nothing happens when I run "perl" from the command line

Tags:

perl

If I run perl by itself from the linux command line, nothing happens. I see the cursor move down a line and if I enter print "Hello, world";, still nothing happens. Is there anything I can input from the command line from here? I know that you can run perl -e 'print "Hello, world"'; and how to create a perl script. Just wondering why running perl by itself does nothing.

like image 695
imagineerThat Avatar asked Dec 09 '22 09:12

imagineerThat


1 Answers

Type the following:

$ perl
print "Hello World\n";
Ctrl-D
Hello World
$

That's last line is you holding down the Control key and pressing D. Not typing Ctrl-D.

If you type stty -a, you'll see that Ctrl-D is he EOF character. That's Perl reading in a file from STDIN. Is that what you want?

like image 75
David W. Avatar answered Dec 11 '22 09:12

David W.