Sachin Hegde wrote:
> 
> Hi all,

Hello,

> How do I efficiently delete all the entries in a Hash of arrays.
> suppose I have
> %HOA = { one => [ "a","b","c"],
>                 two => [ "x","y","z"],
>               };

It looks like you don't have warnings enabled otherwise you would get
this warning:

Reference found where even-sized list expected at <program name> line n.

A hash has to be populated with a list with an even number of elements
(2, 4, 6, 8, etc.) while you are assigning a single element (reference
to anonymous hash.)  You need to use parenthesis instead of braces or
assign the reference to a scalar instead of a hash.

my %HOA = ( one => [ 'a', 'b', 'c' ],
            two => [ 'x', 'y', 'z' ],
           );

Or:

my $HOA = { one => [ 'a', 'b', 'c' ],
            two => [ 'x', 'y', 'z' ],
           };


> I want
> %HOA = {};

What you want is:

%HOA = ();



John
-- 
use Perl;
program
fulfillment

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

Reply via email to