Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
So you want to learn Perl eh??? If you're unsure of that much you might want to check What is Perl?

The first thing you might be asking is how do you run a Perl program? The way to do it on most systems is by simply typing:

perl program.pl

This will work so long as perl is on your system and your PATH points to where it is stored. If you're on a Unix or This will make your computer read this as a series of shell commands stored in a file. However this isn't quite what we want. We want it to first run the perl interpreter and then have that process and run the rest of the program.Linux system another more common way of running your program is to make it executable. To do this you type something like

chmod +x programfile.pl

To do this we have to add one line at the beginning of the program file. Most of the time that looks something like this

#!/usr/bin/perl

If this doesn't work your perl interpreter may be in another location to find out where that might be you could type

where perl
to find where it's stored if this yields something like /usr/contrib/bin/perl simply change that first line to #!/usr/contrib/bin/perl and you should be golden.

To make sure all that is working we may as well write up the obligatory "Hello World" program to test it out. How about something like:
#!/usr/bin/perl print "Hello World!\n";

Now save that in a file like helloworld.pl do a chmod +x helloworld.pl and then try running it by just typing helloworld.pl at your command prompt. With any luck it should print out:

Hello World!
Now you should check out the basic datatypes, three

In reply to The basics by root

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (6)
    As of 2014-08-23 19:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (178 votes), past polls