#usr/bin/perl -w use strict; my $zip = "12345"; my @accepted = qw (12390 12351 12345 01241); foreach my $thiszip (@accepted){ print "Matched ", cmpZIP ($zip, $thiszip), "\n"; } sub cmpZIP { my ($zip_a,$zip_b) = @_; if ($zip_a eq $zip_b){return 5} my ($ichi, $ni, $san)=unpack ("a3aa",$zip_a); my ($ein, $zwei ,$drei)=unpack ("a3aa",$zip_b); if (($ichi eq $ein)&&($zwei eq $ni)) {return 4} if ($ichi eq $ein) {return 3} return 0; }