in reply to Check If 2 Arrays Match

Maybe you want something more like this
#!/usr/bin/perl -w use strict; my @ray = qw(one two three); my @two = qw(two next four); foreach my $x (@ray) { foreach my $y (@two) { print $x if ($x eq $y); } }
If you just use @two in the regex match, it will expand to the entire array, ie, you are asking if the filename matches the entire list of filenames, not one of them. Eg.
if ($ID=~ m/one.txt two.txt three.txt/)
which no file will have that name. In this situation methinks it matters not so much, but "eq" will only match exactly, whereas =~ will match if the pattern is a substring.