1Set::Scalar::Valued(3)User Contributed Perl DocumentationSet::Scalar::Valued(3)
2
3
4

NAME

6       Set::Scalar::Valued - valued sets
7

SYNOPSIS

9           use Set::Scalar::Valued;
10           $s = Set::Scalar::Valued->new;
11           $s->insert(a => 12, 'b c' => $d);
12           $s->delete('b c' => $d);
13           $t = Set::Scalar->new(x => $y, y => $z);
14

DESCRIPTION

16       Valued sets are an extension of the traditional set concept.  In
17       addition to a member just existing in the set, the member also has a
18       distinct value.  You can think of this a combination of a traditional
19       set and a Perl hash.
20
21       The used methods are as for the traditional of Set::Scalar, with the
22       difference that when creating (new()) or modifying (insert(), delete(),
23       invert()), you must supply twice the number of arguments: the member-
24       value pairs, instead of just the members.  Note, though, that in the
25       current implementation of delete() the value half is unused, the
26       deletion is by the member.  In future implementation this behavior may
27       change so that also the value matters.
28
29       There are a couple of additional methods:
30
31           %ve = $s->valued_members;
32
33       which returns the member-value pairs, and
34
35           @v  = $s->values;
36
37       which returns just the values (in the same order as the members()
38       method would return the members), and
39
40           $v  = $s->value($member);
41
42       which returns the value of the member.
43
44       The display format of a valued set is the member-value pairs separated
45       by " => ", the pairs separated by ", " and enclosed in curly brackets
46       {}.
47

AUTHOR

49       Jarkko Hietaniemi <jhi@iki.fi>
50
51
52
53perl v5.32.0                      2020-07-28            Set::Scalar::Valued(3)
Impressum