Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

storulis (6010)

storulis
  (email not shown publicly)

Journal of storulis (6010)

Tuesday June 28, 2005
03:45 AM

My first step

[ #25397 ]
#!/usr/bin/perl
print "\"Hello World\"\n";
print "I think this step was not difficult\n";
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The quoting on the line
    print "\"Hello World\"\n";
    may be written as
    print qq|"Hello World"\n|;
    print qq{"Hello World"\n};
    to avoid escaping the doublequote char (for less cluttered code).

    (type "perldoc perlop" and search for "Quote-like" to read more)

    I guess those small things is what makes people say Perl code is unreadable. No, wait!?! That doesn't seem right...
  • I'd suggest this as a good second line:

    use strict;

    It's a good habit to get into. Spots many common errors and points them out to you, when you try to run the script. Even finds them before you try to run the script, if you use the "-c" option from the commandline. For example:

    perl -c myscript.pl

    For even more information about possible trouble spots in your program, add this line, too (up towards the top somewhere):

    use warnings;

    While you're learning, you'll get more verbose (explanatory) er