sub delete_thefruits my $collection; my $criteria; #### for (ref $entry){ ## i think this will check for the type being input by the user when ('fruitdb::name') { $collection = $FRUIT_NAMES; $criteria->(name) = $entry->{data}{name}; #### $collection-> remove(criteria); ## this will hopefully eventually remove one entry whether it's fruit name or fruitID }