PWC #250
PWC 250 Disclaimer on earlier "Perl 4" attempts In my previous challenges, I often mentioned sticking to Perl 4 syntax. I did not actually have Perl 4, so could not test on that platform. Recently, I did manage to find an old MS-DOS executable of Perl 4.019 that I can run in DOSBOX. I quickly found that my "Perl 4" answers to earlier challenges will not run in Perl 4. Particularly, my habit of using "local * xxx = sub { ...};" to create a localized sub will not work on Perl 4. Firstly, the "local" keyword must be used with a bracketed list of arguments, as local (*x, ...). The statement form "local *x," gives a syntax error. Secondly, the sub keyword cannot appear on the right-hand-side of an assignment. Syntax error again even with "local (*x)=sub {..};" . Looks like this facility to assign a sub to a local glob only became available in Perl 5. In Perl 4, looks like subroutines always had to be global or package-level in sco