#!/usr/bin/perl -w # Strict use strict; use warnings; # Data my @DB = qw( AB1/1 AB1/5 AB2/5); my @Input = qw( AB1/1 AB1/2 AB1/5 AB1/6 AB1/9 AB2/2 AB2/5 AB2/6 AB2/9 AB2/13 ); # Main program &show_me("From DB", \@DB); &show_me("From Input", \@Input); # Make a hash from the DB array, and run the Input list looking for matches my %DB = map { $_ => 1 } @DB; foreach my $input (@Input) { my $result = defined($DB{$input})? "Found": "NotFound"; printf "%s : %s %s\n", $input, $result, $input; } # Subroutines sub show_me() { my ($msg, $pdata) = @_; print "$msg:\n"; map { printf " %s\n", $_ } @$pdata; print "\n"; }