http://qs1969.pair.com?node_id=1075621

doubleqq has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have a list of files like so:

lab1_set1.txt lab1_set2.txt lab2_set1.txt lab2_set2.txt lab3_set2.txt ..... labn.set1.txt labn_set2.txt

for each pair I want to notify the user that the set was paired and notify the user if a set is unpaired.

I currently have the files read into an array. What I don't know is how to set up the regex and use that compare the filenames. My code so far seems off track... the mental block for me is how do I traverse the array and match on a regex condition? My conceptual code below hopefully reveals the deficiency in my thinking...

for (@labsets) { if ($_ ~= /^lab\d{1}/) = [some condition] { print "$_ matched\n!" } else { print "print $_ did not match\n"; }
Thank you all for any pointers and/or insight.