Hi, You have done a great job with your explanation.
The code is clean well commented and I believe solves the problem. What I doubt is if he will understand references cos he is new to perl.
My advice will be for him to first of all get comfortable with the basic before attempting to cracking or solve difficult task.