in reply to Re^2: difference in regex
in thread difference in regex

Because ($path, $value) is a list, you get the list of submatches (list context). But if you do something like:

if ($row =~ /(.*),(.*)/) { ... }
since the if expects a boolean, the operation will return true if something matches, and false otherwise (boolean context). And you can still access the left and right part as $1 and $2. So you can do:
my $path = $row; # path is the full string by default if ($row =~ /(.*),(.*)/) { my $left_part = $1; my $value = $2; # Check if $value is a number and change $path if needed ... }