Instead of matching on a particular character, you can match a type of character. Each character has a property, they can all be found in the perluniprops documentation.
\!h # To match a particular property, you put the name in \p{PROPERTY}
# Example - to match any sort of space, use the 'Space' property:
if (/\p{Space}/) {
print "The string has some whitespace.\n";
}
# The above is slightly more expansive than \s as it matches more properties, like NEXT LINE or LINE TABULATION (vertical line).
# Example 3 - more specific properties
# Match two hex digits next to each other:
if (/\p{AHex}\p{AHex}/) {
print "The string has a pair of hex digits.\n";
}
\!h Negate any property with an uppercase p:
if (/\P{Space}/) { # not space
print "The string has one or more non-whitespace characters.\n";
}