Untested.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @account = qw( 96329XY 7776fc 334457yg 2233oop 000001 8877666b); my @file = qw(8877666b.txt 2233oop.txt 334457yg.txt 7776fc.txt 96329X +Y_K.txt); my %seen; for my $acc (@account) { next unless $acc =~ /^\d+/; $seen{ $acc }++; # I'm not sure why you were pushing onto an array + to test for existence. } #print Dumper %seen; for my $filename (@file) { next unless $filename =~ /^(\d+.*?)\.txt$/; my $basename = $1; print "seen in account array: $basename\n" if exists $seen{ $basen +ame }; }
In reply to Re: Compare two arrays
by mr_mischief
in thread Compare two arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |