Hi,

Perl is my first language too.

Lot of great folks here have suggested good points, so nothing much to add however, you might find the following points useful.

The best code to mess with is the one you write yourself. Because you have written it, you know it, you can tweak it and see what happens.

I wrote something like this after dabbling with Perl initially:

#!/usr/bin/perl use warnings; use strict; print "Enter your name: "; chomp(my $name = <STDIN>); print "Your name is: $name\n";

And then I supplied my name. And it printed fine. Then I supplied it a number. And it still printed fine. The same thing failed when I tried in C, but Why? Because C makes you create a variable of type char or int or float. But not so with Perl. And off I went (re) reading about how Perl treats variables, how 4x4 is different from 4*4. Write your own code and mess with it. Once you are sure that it's running fine, purposely remove a colon, or a comma or something like that and see what error you get. That's the best way to learn when picking up Perl.

Try Strawberry Perl if you are on Windows. Its at - http://www.strawberryperl.com. It's easier to install modules in Strawberry Perl and there's a portable version available. So that you can extract it to a folder, do your stuff and copy the folder to a USB and try it out on any other Windows based computer. No need to install Perl :)

As mentioned by other folks here, Learning Perl is a great book and so is Beginning Perl (By Curtis Ovid Poe). You can get any (or both) and get started.

Most important: Don't do the mistake I did. I skipped the exercises in hope of saving time and learning quickly. It simply didn't work. I had to go back and do the exercises. It does make a difference.


In reply to Re: Most basic code to mess around with? by pritesh
in thread Most basic code to mess around with? by ATL_perl

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.