[MacPerl] using references with hashes
[email protected] (Louis Pouzin) Wed, 3 Aug 2005 16:01:58 +0200 (CEST)
| Newsgroups | perl.macperl |
|---|---|
| Message-ID | <[email protected]> |
Good morning/afternoon/night,
To avoid cluttering scripts with intricate expressions I tried references,
with mixed results. e.g. instead of:
delete $H{one}{two}{three}[0]{four} if exists $H{one}{two}{three}[0]{four};
I'd prefer to write:
$ref = \$H{one}{two}{three}[0]{four};
delete $$ref if exists $$ref; # or somesuch.
While I could get each, keys, and values, out of references, I haven't figured
out a working syntax for exists, delete, and growing hashes.
Perhaps someone could suggest a right way. Thanks.