It seems a little bit much to ask in my opinion of a one-liner, but what do you think? Part of my question is whether this is a good quiz or not.
In my opinion, this problem does not seem like a good candidate for a Perl one-liner solution. A good
practical use of a one-liner is to do something quick and dirty on the command line which is too cumbersome with other tools (like
grep). Anything more complicated is hardly worth it; just put the code in an file.
That being said, a good impractical (and fun) use of a one-liner is a Perl golf tournament.