in reply to Re^3: Str extract the word between the first and the 2nd '|' character
in thread Str extract the word between the first and the 2nd '|' character

$foo =~ m// returns different thing depending on context.

In scalar context it just returns true if $foo matched the regexp and false if it didn't. In list context it returns a list of the things captured by the regexp.

Declaring a variable like my ( $bar ) = ... forces list context on the right-hand-side of '=', which, in this case forces the match to work in list context.