in reply to Re: Why this is work?
in thread Why this is work?

That's a bit narrow, no? Perl considers these numerals: 1_3 (or even 1____3 discounting strictures/warnings), 0xd, 0b1101, and 1.3e1 as you know. If \d should not match things Unicode defines as numbers then logically \w should not match any letters outside ASCII. /a and /u can be used to clarify and limit the regular expression too.

Replies are listed 'Best First'.
Re^3: Why this is work?
by Jenda (Abbot) on Jun 04, 2018 at 09:18 UTC
    say ('1_3' + 0); say ('0xd' + 0); say ('0b1101' + 0); say ('1.3e1' + 0);

    Literals are irrelevant, the conversion from string to number is what counts, because that's what's more often than not what happens to the matched string, and only the last one actually works.

    There's no reason whatsoever not to require \p{Number} for the rare use case of "give me anything that might be a digit to someone".

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.