366. Re: keys of anonymous hash


番号順一覧Top スレッド順一覧Top
作者: 藤岡和夫
日時: 2004/4/16(22:54)
On Fri, 16 Apr 2004 22:09:05 +0900
"Bruce." <kbk@...> さんwrote:

> %hash = (a => b, c=>d, e=>f);
> $hareshre = \%hash;
> print keys $hashref;
> 
> とすると
> 
> Type of arg 1 to keys must be hash (not scalar dereference) at hash.pl line 3, near "$hashref;"
> Execution of hash.pl aborted due to compilation errors.

%hash = (a => b, c => d, e => f);
$hashref = \%hash;
print keys %$hashref; # hashのデリファレンス

でいいのでは。

藤岡 和夫
FGALTS@...
kazuf@...
TS Networkのために http://homepage1.nifty.com/kazuf/
前の発言: 365. keys of anonymous hash [Bruce.] 2004/4/16(22:09)
後の発言: 367. Re: keys of anonymous hash [藤岡和夫] 2004/4/16(23:41)
親発言: 365. keys of anonymous hash [Bruce.] 2004/4/16(22:09)
子発言: 369. Re: keys of anonymous hash [Bruce.] 2004/4/17(00:16)