develooper Front page | perl.golf | Postings from July 2002

Re: Golf this.

Thread Previous | Thread Next
From:
Andrew.Savige
Date:
July 16, 2002 00:14
Subject:
Re: Golf this.
Message ID:
694BB7191495D51183A9005004C0B05452DE7F@ir-exchange-srv.ir.com.au
En op 16 juli 2002 sprak |3en:
> Hu... I may make a mistake, but...
>
> Isn't this one...
> -p $h{$_}++}for(sort%h){
>
> ...shorter ?

Yes |3en, this is your third mistake.
Your first was challenging `/ in tpr04, and your
second was challenging him yet again in tpr04b.

Because we are using %h and not keys%h you must
set it to "" and not a number. Rick's
  -p $h{$_}=1}for(sort%h){
suffers from the same bug.

You can fix like this:
  #!perl -p
  $h{$_}++}for(sort keys%h){

/-\

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