Hi,

As above, I want a delete method for a hash key - ideally
Myhash.mykey.delete But that I guess would be a scalar method. So I'm
settling on Myhash.delete ("mykey")

I know I can manipulate the stash by doing something like:

$Template::Stash::HASH_OPS->{ reverse } = sub {
        my $h = shift;
        my %r = reverse %{$h};
        \%r;
};

 but, I want to modify the source so it will be available in all perl
programs without me having to do the above. So, I have

    'delete'  => sub {  
        my ($hash, $key) = @_; 
        delete $hash->{$key};
                undef;
    },

In $HASH_OPS in Stash.pm, but although this seems to work obviously it
working on a local copy of the hash. I don't like this syntax (although it
works) - Myhash = Myhash.delete ("mykey")

Is this the best way to approach the problem?

Cheers, jamie


_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to