I am trying to display unique values from two strings "ABCDE", "BCDEO" to return "AO" with the below code
#!/usr/bin/perl -w
use strict;
use warnings;
my $string1="abcdef";
my $string2="defghi";
my @ary=split(//,$string1);
push @ary,split(//,$string2);
my %een=();
map{ $een{$_}++ } @ary;
my @unique=();
foreach (@ary){
next unless $een{$_} == 1;
push @unique,$_;
}
printf "%s\n",join(",",@unique);
Hashes are our friends....
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg