I ran this and it works, but I am not sure I understand why.
- 'd+' is one or more digits. The 'g' option causes the regex to find all greedy matches of d+, which is, say, '2001', '02' and '14'.
- The regex returns a list of these finds.
- 'shift =~' causes the regex to read as input the first parameter sent to the changedate function.
- join and reverse are as usual.
- Finally, even though there is no explicit return in the sub, it by default returns the last value calculated, which is the the value returned by join.
Wow! Is Perl powerful or what? I am in awe of Larry and the Perl 5 Porters who wrote it.