Shiping Wang wrote:
> ###################################################################
>
> foreach my $element (keys %count) {
> push @union, $element;
> push @{ $count{$element} > 1 ? [EMAIL PROTECTED] : [EMAIL PROTECTED] },
> $element;
>
> } # you have declared my for @union, @intersection and @difference above
> ###################################################################
Thank you Mr. Wang. That change worked perfectly.
It's incredible how well that script works. I guess I got
in trouble by jumping too far forward with my my's :-)
Now I should be able to figure out how it works with
only a few hours of work, or less.
Also, I get the digest version of this list, so I won't see
many other responses that have probably already been
posted until later.
The final script is:
use strict;
use warnings;
my @array1 = ("a","b","c","d","e","f","g");
my @array2 = ("h","b",'c',"i","j","k","g");
my @union = my @intersection = my @difference = ();
my %count = ();
foreach my $element (@array1, @array2) { $count{$element}++ }
foreach my $element (keys %count) {
push @union, $element;
push @{ $count{$element} > 1 ? [EMAIL PROTECTED] : [EMAIL PROTECTED] },
$element;
}
print "@intersection,\n\n\n";
print "@difference,\n\n\n";
print "@union,\n\n\n";
# another print statment telling the reader what to do next
print "Press <ENTER> to continue...";
# Perl waits at these brackets for user input
<>
Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]