vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:
use Data::Dumper; sub Create_arrayref{ [@_]; }; sub Create_hashref{ {@_}; }; my $hash_ref=&Create_hashref(1,2,3,4,5,6,7,8,9,'ree'); print Dumper $hash_ref; my $array_ref=&Create_arrayref(1,2,3,4,5,6,7,8,9,'ree'); print Dumper $array_ref;
In the above code I tried to create the reference for the array and hash, For array I was getting array reference correctly but, for hash I was getting 10, When I use return like return {@_};it giving hash reference, why it is like that any specific reason ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating reference to hash and array
by gone2015 (Deacon) on Apr 10, 2009 at 15:00 UTC | |
by vinoth.ree (Monsignor) on Apr 11, 2009 at 04:28 UTC | |
|
Re: Creating reference to hash and array
by Bloodnok (Vicar) on Apr 10, 2009 at 14:49 UTC | |
by wol (Hermit) on Apr 14, 2009 at 11:11 UTC | |
by Bloodnok (Vicar) on Apr 14, 2009 at 11:19 UTC | |
|
Re: Creating reference to hash and array
by kennethk (Abbot) on Apr 10, 2009 at 14:37 UTC | |
|
Re: Creating reference to hash and array
by jethro (Monsignor) on Apr 10, 2009 at 14:35 UTC | |
|
Re: Creating reference to hash and array
by Anonymous Monk on Apr 10, 2009 at 14:36 UTC | |
|
Re: Creating reference to hash and array
by bichonfrise74 (Vicar) on Apr 10, 2009 at 16:51 UTC |