Nothing returns a scalar in list context. If it's in list context, it will return a list. Even if it's a single element list. ;-)
Note that a failing regex in list context returning anything but an empty list would be very inconvenient, as this code is common:
if (my @matches = $var =~ /PATTERN/) {
# match
}
else {
# did not match
}
If the failing match would return undef, 0, or the empty string, the result of the assignment becomes true (because a list assignment in scalar context returns the number of things on the RHS of the assignment). | [reply] [d/l] |