Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Tony Frasketi
Thanks to all who answered - I really appreciate the help! Now busy reading perldoc perlreftut ! Tony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Deprecated perl hash reference statement problem

2005-10-04 Thread Timothy Johnson
Tony Frasketi wrote: >Both $hash->{$key} and $$hash{$key} work fine and this also works >Although I'm not sure why ${$hash}{$key}. There is a reason for this. Let's say you had two variables: %hash (a hash) $hash (a hash reference) You could confuse the interpreter if you wrote this:

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
On Oct 4, Tony Frasketi said: Both $hash->{$key} and $$hash{$key} work fine and this also works Although I'm not sure why ${$hash}{$key}. The reason ${$hash}{$key} works is because it's a generalization of $$hash{$key}. The rule of thumb is: 1. start with $HASH{key} 2. replace HASH wit

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Tony Frasketi
Jeff 'japhy' Pinyan wrote: %hash->{$key} and @array->[$idx] are syntaces that you should not use. The fact that they work is due to intricacies of the Perl parser. Similarly, %{$hashref}->{$key} and @{$arrayref}->[$idx] are equally bad. Use $hash{$key} and $array[$idx] for normal hash and a

RE: Deprecated perl hash reference statement problem

2005-10-04 Thread Timothy Johnson
>Timothy Johnson wrote: > >>It depends on what you're trying to do. if $hashRef is a hash >>reference, then the correct syntax would be: >> >> $hashRef->{$key} = $value; >> >>or >> >> %{$hashRef}{$key} = $value; >> >>What you're saying below is something like: >> >>-- Take $hashRef and deref

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
On Oct 4, Tony Frasketi said: sub get_form_data_1 { my($hashRef) = @_; my($buffer) = ""; my($key,$value,$pair,@pairs); if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; }else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } @pairs = split(/&/, $buffer); for

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Tony Frasketi
Timothy Johnson wrote: It depends on what you're trying to do. if $hashRef is a hash reference, then the correct syntax would be: $hashRef->{$key} = $value; or %{$hashRef}{$key} = $value; What you're saying below is something like: -- Take $hashRef and dereference it to %HASH1 (I'm giv

Re: Deprecated perl hash reference statement problem

2005-10-04 Thread Jeff 'japhy' Pinyan
On Oct 4, Tony Frasketi said: I've used the following statement in several instances before and never had any errors reported and the programs all seem to work ok. %{$hashRef}->{$key} = $value; %hash->{$key} and @array->[$idx] are syntaces that you should not use. The fact that they work i

RE: Deprecated perl hash reference statement problem

2005-10-04 Thread Timothy Johnson
m: Tony Frasketi [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 04, 2005 11:33 AM To: beginners@perl.org Subject: Deprecated perl hash reference statement problem Hello Listers I've used the following statement in several instances before and never had any errors reported and the programs

Deprecated perl hash reference statement problem

2005-10-04 Thread Tony Frasketi
Hello Listers I've used the following statement in several instances before and never had any errors reported and the programs all seem to work ok. %{$hashRef}->{$key} = $value; But since I've began using use strict; use warnings; use diagnostics; in my programs, I'm now starting