in reply to Grep and AoH references

my $newAoH = [ grep { !( $_->{name} eq 'fred' ) } @{$AoHref} ];

You have to dereference $AoHref to look like an array. That's the @{$AoHref} part. And you have to create a new arrayref to feed to $newAoH. That's the [ ......... ] part... unless you really meant to feed @newAoH (a proper array), instead of $newAoH (a reference to an array).


Dave

Replies are listed 'Best First'.
Re^2: Grep and AoH references
by bradcathey (Prior) on Dec 30, 2004 at 16:52 UTC

    Thanks davido. Worked like a charm. And thanks for the explanation.


    —Brad
    "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton