On Fri, Feb 20, 2009 at 13:53, mritorto <mrito...@gmail.com> wrote: > Owen,
Chas. Owens, not Owen. snip > I got it to work using your script and the list compare module > > I figured that I had to copy the files to a certain directory . The > directions cspan gave were wrong for windows snip You should probably not be using CPAN if you are on windows (unless you are using Strawberry Perl or Cygwin Perl, but in those cases CPAN will do the right thing). Use the PPM* command instead. snip > what does this mean? > > ##### > > my $comparison = List::Compare->new(\...@atlas, \...@isis); snip List::Compare is a class. new is one of its methods. The new method instantiates a object which is stored in $comparison. This object holds all of the information about the comparison of @atlas and @isis. There are \s on the two arrays because the new method wants references to the arrays instead of the arrays themselves. This is for at least two reasons: If they were passed as new(@atlas, @isis), then you would not know where @atlas stops and @isis starts inside the method. Perl has variadic parameters**. This means a function will take any number of arguments. Because they take any number of arguments arrays are flattened (that is turned in to lists) during the call. The other reason is it is more efficient to pass two references than to pass however many items are in both @atlas and @isis. snip > print $comparison->get_symmetric_difference; ( the words from > $comparsion on ward) snip The $comparison object holds all of the information about the comparison. We just need to ask it the right question to get it to tell use what we want to know. The get_symmetric_difference method is that question. I found the method by looking through the docs***. The description says "Get those items which appear at least once in either the first or the second list, but not both." This seemed to be what you desired. snip > and are these certain modules > use warning > use strict snip Modules that do not start with an uppercase letter are called pragmas (or pragmata, depending on whether you think there are octopuses in the sea or octopi). Pragmas are pragmatic instructions to the Perl. That is they change the way Perl works. The warnings pragma tells Perl to print a message to STDERR every time it sees something that might be an error (such as using an undefined value). The strict pragma enforces a stricter programing style than the one Perl allows by default. Specifically it forces you to declare variables (with my, our, or use vars) and turns off two things: symbolic references (we don't need them anymore, we have real references) and the interpretation of barewords as strings. The declaration of variables is what we really want, the other two are just misfeatures of the language we are turning off. ActivePerl comes with the entirety of perldoc in HTML form. Look in your start menu for ActiveState. You can also use perldoc.perl.org. It too contains the entirety of perldoc. I would suggest starting at http://perldoc.perl.org/perl.html. You may want to buy Learning Perl**** and Programming Perl*****. * http://docs.activestate.com/activeperl/5.6/faq/ActivePerl-faq2.html ** by default that is; however, there are things called prototypes that can change this, but they were an experiment and are fundamentally broken and should not be used unless you know exactly what the are good for. *** http://search.cpan.org/dist/List-Compare/lib/List/Compare.pm **** http://oreilly.com/catalog/9780596101053/ ***** http://oreilly.com/catalog/9780596000271/ -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/