Results 1 to 7 of 7
Thread: Question about Perl
Dec 4, 2010, 07:12 #1
- Join Date
- Dec 2010
- 0 Post(s)
- 0 Thread(s)
Question about Perl
I'm new to Perl programming and I actually posted this question in another forum, but later found out that forum barely had any visitors and thus my question was never really answered. So I'm posting this here hoping someone can help me out
I'm learning Perl from few handy books and the problem goes like this:
First, using Textpad, I typed the following statement:
print "Hello, World!\n";
After that, I saved it as Helloworld.pl
I did it this way because this was an exercise from the book I'm learning from (Beginning Perl, 3rd Edition) - this is how the book instructed me to do so. Second, my book then asks me to pop open cmd and create two directories through the cmd (I'm using Windows Vista; 64).
One directory as c:> mkdir begperl
second directory as c:> cd begperl
I did it their way, and really no directories were created. I only saw two files (0 bytes worth) on my c folder. So then I just created those two folders manually on the c drive.
My book then asks me to go to cmd again, and type this statement in: $ perl helloworld.pl (it's the file I saved before) - the book tells me that it should produce the phrase "Hello World!" however the command prompt tells me that $ is an unknown character.
Something was fishy to me, because when I was programming with Python, Python came with it's own Python cmd, and I expected Perl to have the same, but it didn't. Then I looked in the internet, and I went to Perl.org and I downloaded Strawberry Perl Interpreter from Perl.org. This one DOES come with it's own cmd called "Perl (command line)."
I fire that up, and I type in print "Hello World!\n";....and it tells me "Unable to initialize device PRN."
I looked on Google, and someone else was having that problem as well apparently, and he posed the same question on a tech website (link listed below). One reply suggested it's called the "missing PRN bug" or something and advised him to type instead perl -e "print 'Hello World!'"
THAT worked for me (apparently it worked for the guy who asked too). I later learned that -e is something you use for single line statements (as stated in my book).
So my question to you is, what do I do? Every time I write a program, do I have to attach the -e for each statement? If so, I don't think the underlying problem would really be solved. I just dont know what this "unable to initialize device PRN" message means. Does it mean perl did not install properly and I have to reboot my PC? Could you set me straight as to what's really going on?
Thank you very much for any help you send my way. I highly appreciate it.