This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
charnames.pm: refactor so complex re is used once
The :short option which looks like "greek:letter" is just a special case
of the option where a list of possible scripts is set up in the pragma
call. In this case, greek is the single script to look up. It also
turns out that, contrary to the prior code, :short is effectively
mutually exclusive of checking through that list of scripts. That is,
"greek:letter" didn't match in the :short option, it won't match any
script option either because ':' is not a legal character in a name. So
there is no need to execute both. I refactored the code to do an if
then else because of this.
And they both use the same complicated regex that I may have to change
in future patches. So I refactored the code to use the same re
Finally, I added a goto to eliminate a test.