> Hi guys (and gals!), > > I want to compare a constant, known (expected values) array with the > results I'm collecting in another array. > > Something like this, but I don't think this works the way I want it to: > > my @rray1 = qw( One Two Three ); > chomp( my @rray2 = <STDIN> ); > > print "The 2 arrays are the same\n" if( @rray1 eq @rray2 ); > > So that if I enter: > One<enter> > Two<enter> > Three<enter> > <ctrl-D> > on the terminal when I run the code, It will print "The 2 arrays are > the same" on the next line. > > However, my tests seem to indicate I don't really know what's happeneing when I: > @rray1 eq @rray2 > > Can someone help me? > > --Errin
The above does not work because 'eq' is forcing the arrays into scalar context, therefore you are testing whether the length of the arrays is string (not numeric that would be C<==>) equal. But how to do this can be found in the FAQ, perldoc -q 'test whether two arrays or hashes are equal' perldoc perlfaq4, has some other juicy bits about analysing arrays and other data stores. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>