|
DP::Perl - several languange extensions |
DP::Perl - several languange extensions
use DP::Perl qw( :ALL );
... ...
=head1 DESCRIPTION
nothing
$bool = all_defined( @values )
Return FALSE if some of values in array are undefined
@values_by_filtered_keys = hf( $precompiled_regex, %hash_array )
%hash_array_of_filtered_keys = %{hf( $precompiled_regex, %hash_array )}
EXAMPLE:
%hash = (key_ax=>'val_ax', key_ay=>'val_ay', key_bx=>'val_bx', key_by=>'val_by');
@values = hf(qr/\w+/,%hash);
%values = %{hf(qr/\w+/,%hash)};
=cut
### -------- sub hf ($\%) ### -------- { my( $re, $h ) = @_; if( wantarray ) { return @$h{grep(/$re/,keys(%$h))} } else { return {map(($_,$$h{$_}),grep(/$re/,keys(%$h)))} } }
set_hmv( \%hash, $key, $val, [ $force_single ] );
set hash multi-value - for multiple appearances of same key are values stored as arrayref rather than direct value. Usefull when parsing cooikes or url with multiple param names.
$force_single set to 1 drops/replaces previously stored values with the $val for the $key specified.
SEE ALSO the get_hmv manpage
get_hmv( \%hash, $key, [ $index ] );
get hash multi-value - counterpart for the set_hmv manpage.
TIP: use $index = -1 to get last value or other negative values to index from end of values array. (Same way as with common perl array)
project started: 2003/05/09 >
$Id: Perl.pm_rev 1.5 2004/01/08 11:10:30 root Exp root $
Daniel Peder
<Daniel.Peder@Infoset.COM> http://www.infoset.com
|
DP::Perl - several languange extensions |