hey rob thanks from me too :-)
u shore did a great job of teaching

Regards
Saurabh

--- [EMAIL PROTECTED] wrote:
> 
> Hey, Rob, thanks!  That was really useful.  Just
> from sitting in the
> background, reading these posts, I learn a lot.
> 
> Thanks,
> 
> Scott
> 
> Scott E. Robinson
> SWAT Team
> UTC Onsite User Support
> RR-690 -- 281-654-5169
> EMB-2813N -- 713-656-3629
> 
> 
>                                                     
>                                                     
>                            
>                       "Rob Dixon"                   
>                                                     
>                            
>                       <[EMAIL PROTECTED]       To:  
>     [EMAIL PROTECTED]                              
>                            
>                       .co.uk>                  cc:  
>                                                     
>                            
>                                               
> Subject:  Re: References...                         
>                                  
>                                                     
>                                                     
>                            
>                       06/10/03 08:39 AM             
>                                                     
>                            
>                                                     
>                                                     
>                            
>                                                     
>                                                     
>                            
> 
> 
> 
> Hamish Whittal wrote:
> > Hi All,
> >
> > I'm still a little confused...
> > What is the difference between
> >  %{$config_file->{$key}}
> 
> Here, $config_file is a hash reference. If you print
> it it will
> display something like
> 
>   HASH(0x12345678)
> 
> The hash it refers to is accessed by the value in
> $key, so if
> you had
> 
>   my $config_file = { K => { K2 => 'V2' } };
>   my $key = 'K';
> 
> then
> 
>     $config_file->{$key}
> 
> would be equal to the anonymous hash { K2 => 'V2' }.
> 
> This value is then dereferenced again as a hash, so
> if
> we have
> 
>   my %hash = %{$config_file->{$key}};
> 
> then
> 
>   $config_file->{$key}
> 
> %hash would be set to
> 
>   %hash = ( K2 => V2 );
> 
> 
> 
> >  %$config_file->{$key}
> 
> Now this is something altogether different. You've
> discovered that you can use hash names as
> references,
> and this is an abuse of Perl and not to be
> encouraged!
> 
> If you had
> 
>   my %config = ( K => { K1 => 'V1' } );
>   my $config_file = \%config;
> 
> then %$config_file is the same as %config, so you
> can access
> the element with
> 
>   $config{K}
> or
>   $config_file->{K}
> 
> What the book doesn't tell you, though, is that Perl
> will
> let you treat the hash name as a reference like this
> 
>   %config->{K}
> 
> which is the same as
> 
>   %$config_file->{K}
> 
> So you've dereferenced $config_file and then used it
> as a reference,
> so achieving nothing.
> 
> To summarize:
> 
>   %$config_file->{$key}
> 
> is the same as
> 
>   $config_file->{$key}
> 
> and so is the same as the first case,
> %{$config_file->{$key}}
> without the additional level of dereferencing.
> 
> But, as I said, don't use the second case!
> 
> Cheers,
> 
> Rob
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


=====
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
SAURABH SINGHVI
H-8,ROOM NO.291
IIT BOMBAY
POWAI
MUMBAI
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to