Skip to main content


I have code like this: my @f1 = ($from =~ m{/[^/]+}g); my @f2 = ($to =~ m{/[^/]+}g); Where ($from, $to) is also aviable as @_. How would I make this into one line, and so I don't have to copy pase the reuse expression. IIUC, map can only return a flat array, or arrayrefs, which you cannot initalise the values with.

submitted by /u/Both_Confidence_4147
[link] [comments]