phunchik phunchik - 1 month ago 5
Perl Question

What does the dollar sign point to in this particualr perl regex


I came across this while running through some regex patterns online, but unable to break it down.

I initially thought it would be normal EOS, but those additional characters, don't make sense.
Any help is appreciated.


This might be a mistake by the author, but $] is treated as special variable here. Specifically, it is an alias of the variable $OLD_PERL_VERSION which contains the version of perl encoded as number, e.g. 5.020002 in my system (corresponding to version number 5.20.2). So that value is inserted in the regex and it is matched literally. So for example, in my system, the above regex will only successfully match against strings that contain the substring AA.5.020002ER or AA<5.020002ER.