use strict; use Data::Dumper; my @searchwords = qw|Bird SnaKe|; $|++; print "MINIMUM NUMBER OF MATCHES PLEASE: "; my $minMatches; $minMatches = ; chomp($minMatches); use XML::Simple; undef $/; open(H, qq|oo.dat|) or die $!; my $filestuff = ; close(H); #print $filestuff; my $newXML = XMLin($filestuff); my $ref = $newXML; #stripe your values foreach my $word (@searchwords) { foreach(keys %$ref){ if (index($ref->{$_}->{words},lc($word)) > 0){ $ref->{$_}->{confidence}++; push @{$ref->{$_}->{WORDSFOUND}}, $word; } } } #print the ones you like foreach(keys %$ref){ my $outline = qq|FOUND @{$ref->{$_}->{WORDSFOUND}} in $_\t| . $ref->{$_}->{words} . qq|\n|; print $outline if ($ref->{$_}->{confidence} >= $minMatches); }