Problems Processing Personalized Perl Presents

The original directions were so simple they were not written down. Save the code in a text file and run it with Perl.

$ perl birthday.pl
Happy Birthday JAPH!!

This no longer works with modern Perl (>5.16).

$ perl birthday.pl
Eval-group not allowed at runtime, use re 'eval' in regex m/(?{print 'Happy Birthday JAPH!!',$/})/ at birthday.pl line 1.

You can see the print line in there. It would have printed everything between the quotes. If you want it to run properly you need to add a command line argument to Perl like this:

$ perl -Mre=eval birthday.pl
Happy Birthday JAPH!!

Facebook is now adding spaces where it splits the message with a newline. There should not be any spaces in the file when you save it and everything should be on one line. Remove any spaces if you are getting a garbled message.

If there is a diacritic in your name, you will get an error due to the UTF-8 conversion from copying from a web page.

$ perl -Mre=eval birthday.pl
Can't find string terminator "'" anywhere before EOF at (eval 1) line 1.

The following will convert the file back to single byte characters, then back again to display in a UTF-8 font.

$ iconv -f utf-8//translit -t ISO-8859-1 -o isobirthday.pl birthday.pl
$ perl -Mre=eval isobirthday.pl | iconv -f ISO-8859-1 -t utf-8//translit -
Happy Birthday José!!