in reply to Re^3: Regex question
in thread Regex question

Also, the form:

my $dir = $1 if ##regex_here##

is a good idiom to become familiar with.

Not with my, though. The behavior of my ... if ...; is undefined.

the lowliest monk