365. keys of anonymous hash


番号順一覧Top スレッド順一覧Top
作者: Bruce.
日時: 2004/4/16(22:09)
Bruce. です。

ちと気になったのですが、無名ハッシュの key 一覧てどう取得するんでしょう?
素直に

%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.

となってしまいます。

-- 
木村浩一
  I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
  mail kbk@...
  web  www.kt.rim.or.jp/~kbk/
前の発言: 364. Re: jperl5.005_04 on Cygwin(make成功) [藤岡和夫] 2004/4/11(09:18)
後の発言: 366. Re: keys of anonymous hash [藤岡和夫] 2004/4/16(22:54)
親発言: 364. Re: jperl5.005_04 on Cygwin(make成功) [藤岡和夫] 2004/4/11(09:18)
子発言: 366. Re: keys of anonymous hash [藤岡和夫] 2004/4/16(22:54)
        367. Re: keys of anonymous hash [藤岡和夫] 2004/4/16(23:41)
        368. Re: keys of anonymous hash [Koichi Yamamoto] 2004/4/17(00:10)