With my last golf game, this worked fine:
perl -anF// -e'@F{%F=@F}=0;121-@F*keys%F||print' words
Then I created a file, f.pl, consisting of:
#!/usr/bin/perl -anF//
@F{%F=@F}=0;121-@F*keys%F||print
and typed:
./f.pl words
and this worked fine too. However, when I now tried:
perl f.pl words
this failed with a syntax error!
This is more of a pest under Windows than Unix.
I then tried:
perl -lpe'$.==1 and $_.="\0"' f.pl >g.pl
to null-terminate the #!/usr/bin/perl line and now:
perl g.pl words
worked just fine!
I think the reason for all this is that in:
perl -anF// ...
the -F string (in C's argv[]) is null-terminated, while in the:
#!/usr/bin/perl -anF//
line it is not.
Is this behaviour considered a bug or a feature or a botch?
Andrew.