Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Beginner project suggestions

by jbush (Initiate)
on Apr 29, 2005 at 14:14 UTC ( [id://452615]=perlquestion: print w/replies, xml ) Need Help??

jbush has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone, I'm new to perl, at least I haven't touched it for about 3 years, and even then I only did the very basics. Well I'm back and want to learn perl. I have six books on Perl from O'Reilly, but each time I look at them I dread going through the books. So I decided to go another route and was curious if anybody had any suggestions.

Currently, I need a script to be written which reads a list of server IP addresses, connects via SSH and then executes commands that are specified in another file. I figure this will be my first "project" and should help me get my feet wet. If anybody else has any projects that is good at getting experience and knowledge of perl, please suggest them.

Jason Bush

Edited by Arunbear: Changed title from 'I'm new!', as per Monastery guidelines

Replies are listed 'Best First'.
Re: Beginner project suggestions
by tlm (Prior) on Apr 29, 2005 at 14:41 UTC

    I think that doing the exercises in Learning Perl is a very good way to start. If you don't have the book, get it; if you already have it, give it another chance.

    It was easy for me to learn Perl because I started using it from day 1 at work. (It helped that my OS was some Unix flavor or other, so Perl fit right in.) I wrote hundreds of short (10-50 line) scripts, mostly for munging text files and analyzing their contents. First I wrote these scripts for my work, but then cow-orkers who were amazed at the magical powers of Perl (and too lazy to learn it themselves) started asking me to write scripts for them.

    So I would recommend starting small with simple munging scripts, and work your way up to full-blown applications. The project that you're setting yourself to do seems to me a bit ambitious, unless you have a lot of non-Perl programming experience in that area already. If the latter is the case, you may be able to get something to work using recipes from The Perl Cookbook, but sooner or later you will have to buckle down and learn the basics.

    the lowliest monk

Re: Beginner project suggestions
by derby (Abbot) on Apr 29, 2005 at 15:21 UTC
    All good suggestions above. My only addition would be to break your first project into more achievable chunks:
    1. create a script that reads commands from a local file and just echo'es them back to STDOUT
    2. create a script that connects via SSH to *one* remote host and does something simple (like ls the current directory). Take a look at Net::SSH.
    3. combine 1 and 2
    4. create a script based upon 3 that doesn't hard code a remote host but uses addresses read from a file.
      Thanks all for the replies. I do have some background in programming, so most of the basics seem to fit right in with perl very well. Since I last posted, I've had a little bit of time to sit down and write up some code... Below is what I have so far.. now to add the SSH code.
      open(FWS,"firewalls.txt") || die "Unable to load firewall list: $!"; while (<FWS>) { chomp; print $_; open(CMDS,"commands.txt") || die "Unable to load commands list: +$!"; while (<CMDS>) { chomp; print $_; } close CMDS; } close FWS;

        Just a FYI (not that it's better to do this). print defaults to $_ so sayin print $_ is the same as saying print

        It makes it more cryptic really, so it's not neccessarily better to do that.. just a FYI
Re: Beginner project suggestions
by jhourcle (Prior) on Apr 29, 2005 at 14:22 UTC
Re: Beginner project suggestions
by tcf03 (Deacon) on Apr 29, 2005 at 14:58 UTC
    My suggestion is to read the books and read through Tutorials.
    "Men have become the tools of their tools."
      --Henry David Thoreau

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://452615]
Approved by Joost
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-06-20 18:39 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.