![]() |
![]()
| ![]() |
![]()
NAMEData::Frame::Autobox - Autobox arrays and hashes for Data::Frame VERSIONversion 0.006004 SYNOPSISuse Data::Frame::Autobox; [ 1 .. 5 ]->isempty; # false { one => 1 }->names; # [ 'one' ] { one => 1 }->isempty; # false DESCRIPTIONThis package provides a set of methods for autoboxed arrays and hashes. ARRAY METHODSisemptymy $isempty = $array->isempty; Returns a boolean value for if the array ref is empty. grepmy $new_array = $array->grep($coderef); mapmy $new_array = $array->map($coderef); atmy $value = $array->at($idx); uniqmy $uniq_array = $array->uniq; set$array->set($idx, $value); lengthmy $length = $array->length; elemsThis is same as "length". flattenmy @array = $array->flatten; Explicitly returns an array. slicemy $slice = $array->slice($indices); copyShallow copy. repeatmy $new_array = $array->repeat($n); Repeat for $n times. repeat_to_lengthmy $new_array = $array->repeat_to_length($l); Repeat to get the length of $l. intersectmy $new_array = $array->intersect($other) unionmy $new_array = $array->union($other) setdiffmy $new_array = $array->setdiff($other) HASH METHODSisemptymy $isempty = $hash->isempty; Returns a boolean value for if the hash ref is empty. delete$hash->delete($key); mergemy $merged_hash = $hash->merge($other); hslicemy $sliced_hash = $hash->hslice($keys); sliceThis is same as "hslice". atmy $value = $hash->at($key); set$hash->set($key, $value); existsmy $bool = $hash->exists($key); keysmy $keys = $hash->keys; namesThis is same as "keys". valuesmy $values = $hash->values; flattenmy %hash = $hash->flatten; Explicitly returns an array. copyShallow copy. renamerename($hashref_or_coderef) It can take either,
my $new_href1 = $href->rename( { $from_key => $to_key, ... } ); my $new_href2 = $href->rename( sub { $_[0] . 'foo' } ); SEE ALSOautobox AUTHORS
COPYRIGHT AND LICENSEThis software is copyright (c) 2014, 2019-2022 by Zakariyya Mughal, Stephan Loyd. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|