examples/hash.plx

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 26 / 26 CC 2 SCAR 2.9
CC
2
Cov
100%
treble
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« examples/array.plx ↑ Summary examples/copied.plx »
1 #!/usr/bin/env perl
2 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Devel::WatchVars;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶sub treble { $_ *= 3 for @_ }
Subroutine treble: called CC=2 SCAR=6.9
9  
10 1 my %color = (
11 red => 1,
12 blue => 3,
13 green => 5,
14 );
15  
16 1 watch $color{blue}, "the blue color element";
17  
18 1 say "initial hash is (", join(", " => (map { "$_ => $color{$_}" } sort keys %color)), ")";
19 1 treble(values %color);
20 1 say "final hash is (", join(", " => (map { "$_ => $color{$_}" } sort keys %color)), ")";
21  
22 1 unwatch $color{blue};
23  
24 1 say "done with program";
25  
26 __END__
« examples/array.plx ↑ Summary examples/copied.plx »