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."


In reply to Using modules for Newbies by logan
in thread The Gates of Perl are not newbie friendly. by Hielo

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.