File: each-delete.t

package info (click to toggle)
libtie-ixhash-perl 1.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 100 kB
  • ctags: 29
  • sloc: perl: 349; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

use strict;
use Test::More tests=>2;
use Tie::IxHash;

my $o = tie my %h, 'Tie::IxHash';

$h{a} = 1; $h{b} = 2; $h{c} = 3; $h{d} = 4; $h{e} = 5;

while (my ($k) = each %h) { 
  if ($k =~ /b|d|e/) { delete $h{$k}; } 
}

is(scalar(keys(%h)), 2) or diag explain(\%h);
is(join(',',keys(%h)), 'a,c') or diag explain(\%h);