Hi,
I'm using the following code to delete values from a hash - I get the
warning (I say warning as it does delete the value) below when delete is
called. Is ther a better way of deleting values from hashes?
        
        foreach $item (%$self) {
                if ($item=~/^$section\.(.*)/) {
                        print "deleteing... $self->{$item}\n";
                        delete $self->{$item}; 
                }
        }

warning:

deleteing... thompson
Use of uninitialized value in pattern match (m//) at TutorialConfig.pm line
132.
Attempt to free unreferenced scalar at TutorialConfig.pm line 131.


An example of what is in the Hash array is:

user2.location = cambridge
user2.firstname = matt
user2.lastname = thompson
user.location = peterborough
user.firstname = mike
user.lastname = duffy

The $section variable is 'user2' so the code deletes all info relating to
user2.

Any recommendations to warning free code?

Thanks in advance,
Matt
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to