Learning how to program /w perl

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Learning how to program /w perl

Post by jshook on Wed Feb 15, 2012 2:34 am
([msg=64380]see Learning how to program /w perl[/msg])

So I just started yesterday trying to learn how to program. I chose Perl as my first language and I'm using this online/PDF book. (I'm on chapter 2 by the way, where it says here-documents)

http://learn.perl.org/books/beginning-perl/

But anyways right now I'm on "Here-documents" and I've copied it exactly like it says on the tutorial:

Code: Select all
#!/usr/bin/perl
#heredoc.pl
use warnings;
print<<EOF;

This is a here-document. It starts on the line after the two arrows, and
it ends when the text following the arrows is found at the beginning of
a line, like this:

EOF


And I get the following error when I run it:

Can't find string terminator "EOF" anywhere before EOF at C:\perl_tests\heredoc.pl line 4

Thanks for your help!
jshook
New User
New User
 
Posts: 6
Joined: Wed Feb 08, 2012 9:28 pm
Blog: View Blog (0)


Re: Learning how to program /w perl

Post by pertti123 on Wed Feb 15, 2012 7:00 am
([msg=64382]see Re: Learning how to program /w perl[/msg])

jshook wrote:And I get the following error when I run it:

Can't find string terminator "EOF" anywhere before EOF at C:\perl_tests\heredoc.pl line 4

Thanks for your help!


Are you using notepad as a text editor? You're probably missing a newline after the last EOF, so just add one.
From perlop:

perlop wrote:If the terminating identifier is on the last line of the program, you must be sure there is a newline after
it; otherwise, Perl will give the warning Can’t find string terminator "END" anywhere before EOF....
pertti123
New User
New User
 
Posts: 13
Joined: Fri Sep 10, 2010 6:02 am
Blog: View Blog (0)


Re: Learning how to program /w perl

Post by jshook on Wed Feb 15, 2012 12:34 pm
([msg=64389]see Re: Learning how to program /w perl[/msg])

Thanks alot dude! :mrgreen: That fixed my problem
jshook
New User
New User
 
Posts: 6
Joined: Wed Feb 08, 2012 9:28 pm
Blog: View Blog (0)



Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests

cron