@names = map ( # start map / # start matching regex # this will place what is matched in the grouping # into $_, or undef if there are no matches \A # match start, kinda like ^, # except will ONLY match begining \/ ? # 0 or 1 literal backslashes \Q # start regex quotemeta $path[$step] # interpolated, and then quotemeta'd \E # end regex quotemeta (?: # non grouping parenthesis \/ # literal backslash (.*) # here is what actually is grouped; # matches the rest of the line )? # end non-grouping parens, 0 or 1 of those \z # match end, kinda like $, # except will ONLY match very end of string /sx # s lets . match newlines; i added the x , @names); # i added parenthesis