Uri,

Perhaps you could supply some code that
would clarify your position.

Here's my complete script:

#!/usr/local/bin/perl -s
use strict; use warnings;
use Data::Dumper;

my %apples = 
(
macintosh => 
        {weight => '10lb', cost => '5'},
red_delicious => 
        {weight => '15lb', cost => '2'},
fuji => 
        {weight => '12lb', cost => '7'}
);

my @test = qw(granny_smith crabapple);

foreach my $t (@test)
        {
        if($::EXISTS) 
                {next unless(exists($apples{$t}));}
        print "$t not found\n" 
                unless $apples{$t}{weight}; 
        } 


print Dumper \%apples;




When I run this with nothing on the command line,
the Data::Dumper shows new keys 'granny_smith' and
'crabapple' in the %apple hash, both having values
of references to empty hashes.

When I run this with -EXISTS on the command line,
the Data::Dumper shows no new keys have been added
to the %apple hash.

what exactly do you mean when you say:

> the exists there is not needed. assuming that
> all the values at the top level of %apples are 
> hash refs, then a simple boolean test at the 
> top level will work just fine.
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to