Re: scoping problem with hash

2006-06-16 Thread Paul Johnson
On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote: Charles Clarkson wrote: @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys %kv_pairs} = values %kv_pairs; %hash = (%hash, %kv_pairs); hmmm,

Re: scoping problem with hash

2006-06-16 Thread Beginner
On 16 Jun 2006 at 12:15, Paul Johnson wrote: On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote: Charles Clarkson wrote: @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys %kv_pairs} =

Re: scoping problem with hash

2006-06-16 Thread John W. Krahn
Beginner wrote: On 16 Jun 2006 at 12:15, Paul Johnson wrote: On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote: Charles Clarkson wrote: @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys %kv_pairs} =

Re: scoping problem with hash

2006-06-16 Thread Mr. Shawn H. Corey
On Fri, 2006-16-06 at 12:15 +0200, Paul Johnson wrote: On Tue, Jun 13, 2006 at 12:06:02PM -0700, Lawrence Statton wrote: Charles Clarkson wrote: @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys

Re: scoping problem with hash

2006-06-15 Thread Lawrence Statton
Charles Clarkson wrote: @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; You can excise a little of the snyactic sugar there @$hash_ref{keys %kv_pairs} = values %kv_pairs; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Lawrence Statton - [EMAIL PROTECTED]

scoping problem with hash

2006-06-13 Thread dermot
Hi, This is a bit of an extension on an earlier post. I am trying to create a data structure from a file (contents below). It is meant to be a hash of hashes but I suspect there is either a typo somewhere or I am hitting some scoping problems. All that is left in the hash is the last data

Re: scoping problem with hash

2006-06-13 Thread Mr. Shawn H. Corey
On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote: print STDERR Dumper(%times); print STDERR Dumper( \%times ); -- __END__ Just my 0.0002 million dollars worth, --- Shawn For the things we have to learn before we can do them, we learn by doing them. Aristotle * Perl

Re: scoping problem with hash

2006-06-13 Thread Dermot Paikkos
On 13 Jun 2006 at 12:27, Mr. Shawn H. Corey wrote: On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote: print STDERR Dumper(%times); print STDERR Dumper( \%times ); That seems to have helped the Dumper output but I still haven't managed to get the other assignments to stick. The

Re: scoping problem with hash

2006-06-13 Thread Mr. Shawn H. Corey
On Tue, 2006-13-06 at 17:20 +0100, [EMAIL PROTECTED] wrote: Hi, This is a bit of an extension on an earlier post. I am trying to create a data structure from a file (contents below). It is meant to be a hash of hashes but I suspect there is either a typo somewhere or I am hitting some

Re: scoping problem with hash

2006-06-13 Thread Mr. Shawn H. Corey
On Tue, 2006-13-06 at 13:08 -0400, Mr. Shawn H. Corey wrote: $times{$hashkey}{home} = $time; $times{hashkey}{total} = $total; # Your code replaces, not augments Consider adding this to your library of useful Perl utilities: # -- # hset %hash, ( $key =

RE: scoping problem with hash

2006-06-13 Thread Charles K. Clarkson
Mr. Shawn H. Corey wrote: : for ( keys %kv_pairs ){ : $hash_ref-{$_} = $kv_pairs{$_}; : } You could use a hash slice there. @{ %$hash_ref }{ keys %kv_pairs } = values %kv_pairs; HTH, Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Programmer 254