Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] perl hashes
- Date: Thu, 18 Sep 2003 15:50:40 +0900 (JST)
- From: Joe Larabell <larabell@???>
- Subject: Re: [tlug] perl hashes
- References: <20030918153325.FE09.B-ROBSON@example.com>
> Passing a hash to a subroutine is just a matter of treating it as a > scalar isn't it? The hash itself can't be passed as a scalar, but you *can* pass a reference to the hash: my( %foo ) = ( ); &bar( \%foo ); Then you have to de-reference it on the other end: sub bar { my( $foo ) = @example.com; ... $$foo{ 'key' } ... ... keys( %{ $foo } ) ... } Or, if you intend to do this a lot, you can define the hash as a scalar reference in the 1st place: my( $foo ) = { }; &bar( $foo ); and dereference the same way. -- Joe Larabell -- Synopsys VCS Support US: larabell@example.com http://wwwin.synopsys.com/~larabell/ Japan: larabell@?jp
- References:
- [tlug] perl hashes
- From: Brett Robson
Home | Main Index | Thread Index
- Prev by Date: [tlug] perl hashes
- Next by Date: Re: [tlug] perl hashes
- Previous by thread: [tlug] perl hashes
- Next by thread: Re: [tlug] perl hashes
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links