Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Beginner project suggestions

by jbush (Initiate)
on Apr 29, 2005 at 14:14 UTC ( #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.

Thanks,
Jason Bush

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

Comment on Beginner project suggestions
Re: Beginner project suggestions
by jhourcle (Prior) on Apr 29, 2005 at 14:22 UTC
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 tcf03 (Deacon) on Apr 29, 2005 at 14:58 UTC
    My suggestion is to read the books and read through Tutorials.
    Ted
    --
    "Men have become the tools of their tools."
      --Henry David Thoreau
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.
    -derby
      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

Log In?
Username:
Password:

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

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

    The best computer themed movie is:











    Results (122 votes), past polls