develooper Front page | perl.fwp | Postings from December 2001

Re: Santa Hole 5 ( Post Mortem

Thread Previous | Thread Next
December 8, 2001 05:09
Re: Santa Hole 5 ( Post Mortem
Message ID:
In article <>,
	Rick Delaney <> writes:
> "Keith C. Ivey" <> writes:
>> I'm surprised no one submitted anything with 0 x10, but I
>> guess those always end up too long.
> I tried a bit but the best I came up with was
> #!/usr/bin/perl -pl
> ($c|=0 x10)++}{$_=$c
> for 24 (instead of 21).

#!/usr/bin/perl -p
($\|=0 x10)++}{

(18) but it misses the final \n and anyways, this technique fails
in general for the empty file. What you really want is code to
execute before the first loop of -p or -n, e.g. something like

#!/usr/bin/perl -pM0;$\=$[x10

but unfortunately -M doesn't work from the #! line and it still 
misses the final \n (it does work without the final \n if used
from the commandline though)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About