NAME

Bio::Gonzales::Util - Utility functions for common tasks

SYNOPSIS

    use Bio::Gonzales::Util qw(undef_slice slice invslice flatten hash_merge as_arrayref);

SUBROUTINES

%sliced_hash = slice(\%hash, @keys_to_slice)
$sliced_hash = slice(\%hash, \@keys_to_slice)

return a new hash with all keys removed that are not in @keys_to_slice.

$sliced_hash = undef_slice(\%hash, \@keys_to_slice)
%sliced_hash = undef_slice(\%hash, @keys_to_slice)

same as slice, but if a key in @keys_to_slice does not exist in %hash, it will result in a additional entry with its value undefined

  my %hash = (
    a => 1,
    b => 2,
    c => 3
  );

  my %sliced_hash = undef_slice(\%hash, qw/a b d/);

  # will result in
  %sliced_hash = (
    a => 1,
    b => 2,
    d => undef
  );
%sliced_hash = invslice(\%hash, @keys_to_exclude)
\%sliced_hash = invslice(\%hash, \@keys_to_exclude)
@elements = flatten($nested_array1, $nested_array2)

SEE ALSO

AUTHOR

jw bargsten, <joachim.bargsten at wur.nl>