my ($keyvalue) =~ /someregex (match).../; # If the match fails, $keyvalue is going to "undefined". # Rather than test for that with some kind of "if" statement, $keyvalue //= ''; #does the job