in reply to Can i stored an array in hashref?

You can. The way you showed it flattens the array, if you don't want that, put a reference to it in your data structure:

my $value = { 'key' => ['value', \@array, 'add']; }

See also: perllol, perldsc, perlreftut.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Can i stored an array in hashref?
by Marshall (Canon) on Nov 26, 2009 at 09:42 UTC
    I like the way that moritz answered. The answer will work great for this specific single question! But I am not sure that the answer will help you in your application.

    my @array = ('test', 'demo', 'work'); my $value = { 'key' => ['value', \@array, 'add']; }
    This puts a reference to @array as the 2nd thing in the anon list that 'key' points to. If the contents of @array can vary and in real application, I presume that it will, then,
    'key' => ['value', [@array], 'add'];
    The above says that I am going to make copy of @array, and then assign a reference to that in this key structure. That is different than assigning a ref to the @array.