On 3 July 2015 at 18:54, bikram behera <jobforbik...@gmail.com> wrote:
> Hi Team,
>
>
> Any body can  explain me how to do perl hash refernce and dereference.
>

Create a hash:

my (%hash) = ( "key" => "value" , "otherkey" => "othervalue" );

Create a reference to said hash:

my $reference = \%hash;

You can also make a hash reference simply in one step with:

my $reference = { "key" => "value", "otherkey" => "othervalue"};

Dereference is simple:

my ( %otherhash ) = %{ $reference };

This material is covered in depth in `perldoc perlref`

-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to