Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: The Gates of Perl are not newbie friendly.

by michaeld (Monk)
on Apr 19, 2003 at 20:10 UTC ( [id://251700]=note: print w/replies, xml ) Need Help??


in reply to The Gates of Perl are not newbie friendly.

I found Robert's Perl Tutorial to be a very good introduction on Perl: http://www.sthomas.net/roberts-perl-tutorial.htm

It touches on every newbie subject you can think of.
If you want to delve into one of them more deeply, the man pages are a good choice.

Cheers,
MichaelD

  • Comment on Re: The Gates of Perl are not newbie friendly.

Replies are listed 'Best First'.
Re: Re: The Gates of Perl are not newbie friendly.
by Hielo (Sexton) on Apr 19, 2003 at 20:30 UTC
    It looks like an excellent "Rank-Newbie" page, I will work my way through it tonight and see if it sheds any light on the hash issue, and if it delves into using modules at all. (two things I am stumbling over at the present).

    Thank you for taking the time to point this site out.

      Modules look imtimidating at first, but they're really cake. Simply load the module at run time. Wow, that doesn't sound simple at all. Here's what I mean:
      #!/usr/bin/perl -w use MP3::ID3v1Tag;
      This allows your code to access the subroutines in MP3::ID3v1Tag. From there, you call them like any other sub.
      use MP3::ID3v1Tag; # Adds the library $mp3_file = new MP3::ID3v1Tag("filename.mp3"); # Creates a new objec +t called $mp3_file. $mp3_file->print_tag(); # calls subroutine print_tag() on the file t +he $mp3_file object is working on (filename.mp3) if($mp3_file->got_tag()) { # calls subroutine got_tag(), which will +return 1 if the tag exists, 0 if not. $mp3_file->set_title($title); # calls subroutine set_title(), +which will set the title to the value $title. In normal practice, you + probably would have parsed out of the filename $save_status = $mp3_file->save(); # calls subroutine save(), c +ommitting your changes. }

      Clear as mud? Think of a module as a big bag of subroutines that you don't have to write. Just read the documentation, and you'll have all you need to know about how to use them, and all the dirty work happens behind the scenes.

      Over time I've found that a new project begins by searching CPAN for relavent modules. If you can find one, you may find that 90% of your work is already done for you.

      One more thing, as you continue coding perl, I can't stress enough how useful The Perl Cookbook will be. It's one book I wish I'd bought on my first day coding.

      -Logan
      "What do I want? I'm an American. I want more."

        I see what you are trying to get across, but it is quite muddy. I am using a simple looking module for getting SETI@Home stats (SETI-WebStats-1.02), so far this is the code I got working

        use SETI::WebStats; my $emailAddr = "wmarcy\@stny.rr.com"; my $seti = SETI::WebStats->new($emailAddr); my $unitsProcd = $seti->numResults; print "Work Units Processed = ",$unitsProcd;
        The third line is what is throwing me, what does it do? I know it is "invoking" the module some how, but I can't fathom how (how is that for a complete idiot newbie question?)

        Thanks for the help!

        Oh, and the program actually works! I am amazed. Even though I only added one line and removed a half dozen or so that I didn't need.

        On looking at my question preview mode, I am also wondering what the operator "->" is doing in the program also?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://251700]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2024-04-23 14:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found