Hi Michael, On Mon, 3 Jun 2013 16:38:25 -0700 Michael Rasmussen <mich...@jamhome.us> wrote:
> On Tue, Jun 04, 2013 at 12:01:09AM +0100, Rahim Fakir wrote: > > Iam using win 7 64bits, and i downloaded Strawberry, and I use Perl PAckage > > Manager to install modules, insted of Cpan command. > > I know how to install them, but I need instrucions how to use them, step by > > step, how-to run the modules. > > Best regards > > Ray > > Hi Ray, > > So, I assume you downloaded whatever modules you chose to because you wanted > the whatever functionality they provide. Since I don't know _what_ modules > you chose I'll give an imaginary example and then a specific example from a > favorite module I use. > > Having said that: > The CPAN page for a module always includes a SYNOPSIS - this gives a very > terse example of using the module. Check there. > > For our example I'll use the fictional raspberry.pm. > It's synopsis reads; > use raspberry; > my $answer = raspberry(); Just a note - you should not call your modules or packages with an initial lowercase letter, as this is reserved for pragmas: http://perl-begin.org/tutorials/bad-elements/#lowercase_modules_and_pkgs (link to a page I created). > > The description says: > raspberry returns a line from the raspberry wisdom list. > > In your code then it might be used: > > #!/usr/bin/perl > use warnings; > use strict; > use raspberry; # the use line incorporates the module code into your > program > > my $answer = raspberry(); # the function call uses code from the module > that you didn't write > > print $answer, $/; > > and the output might be something like > > Raspberries are delicious! Eat some soon to feel good! > > Now for a specific, real world example: > > #!/usr/bin/perl > use Data::Dumper; You forgot strict and warnings. > > [ imagine a bunch of code that does something, but you don't quite know > what ] [ someone else wrote it, and it's now time for you to fix a > problem ] [ there's a huge complex data structure that > hash of arrays or a hash of hashes or ...? ] > > print Dumper( \%my_hash_with_who_knows_what ): Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Free (Creative Commons) Music Downloads, Reviews and more - http://jamendo.com/ One thing I could never understand is why in Microsoft Word, it often happens that I press enter… and the font changes. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/