Help for this page

Select Code to Download


  1. or download this
    my $hashref = { 'key' => 'value' };
    
    ...
    # - or -
    use List::Util qw/sum/;
    my $sum3 = sum map {length} %$hashref;
    
  2. or download this
    my $sum4 = 0;
    while ( my ($k, $v) = each %$hashref )
        { $sum4 += length($k) + length($v) }