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

Re: Santa Hole 5 (wc.pl) Post Mortem

Thread Previous | Thread Next
From:
fun_with_perl
Date:
December 8, 2001 05:09
Subject:
Re: Santa Hole 5 (wc.pl) Post Mortem
Message ID:
9ut3eo$2qu$1@post.home.lunix
In article <m3r8q673y0._s_@cs839290-a.mtth.phub.net.cable.rogers.com>,
	Rick Delaney <rick.delaney@rogers.com> writes:
> "Keith C. Ivey" <kcivey@cpcug.org> 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).
> 

or:
#!/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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About