Re: List of hashes

2008-03-17 Thread yitzle
On Mon, Mar 17, 2008 at 7:12 AM, <[EMAIL PROTECTED]> wrote: > Are subs always return references or only for anonymous lists/hashes? perldoc perlsub "The Perl model for function call and return values is simple: all functions are passed as parameters one single flat list of scalars, and all funct

Re: List of hashes

2008-03-17 Thread Krzysztof . Chodak
On 16 Mar, 18:30, [EMAIL PROTECTED] (Yitzle) wrote: > On Sun, Mar 16, 2008 at 12:54 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > > >  >> push @records, %record > >  > I think you want an array of references, not of hashed themselves. > > >  Actually, the hash is converted to a list and that list

Re: List of hashes

2008-03-16 Thread yitzle
On Sun, Mar 16, 2008 at 12:54 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > >> push @records, %record > > I think you want an array of references, not of hashed themselves. > > Actually, the hash is converted to a list and that list is pushed onto > the array. > > > John Darn! I tested it us

Re: List of hashes

2008-03-16 Thread John W. Krahn
yitzle wrote: Always start your code with: use warnings; use strict; my %record = r(); This line won't work. r() returns a reference (think pointer if you used C) to a hash. You need a scalar to store it. $record = r(); Or dereference the reference returned from the sub: my %record = %{ r()

Re: List of hashes

2008-03-16 Thread yitzle
Always start your code with: use warnings; use strict; > my %record = r(); This line won't work. r() returns a reference (think pointer if you used C) to a hash. You need a scalar to store it. $record = r(); > $record{fieldA}{fieldB} = value... This requires a hash, unlike the above line that use