GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Set::Scalar::Valued(3) User Contributed Perl Documentation Set::Scalar::Valued(3)

Set::Scalar::Valued - valued sets

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

Valued sets are an extension of the traditional set concept. In addition to a member just existing in the set, the member also has a distinct value. You can think of this a combination of a traditional set and a Perl hash.

The used methods are as for the traditional of Set::Scalar, with the difference that when creating (new()) or modifying (insert(), delete(), invert()), you must supply twice the number of arguments: the member-value pairs, instead of just the members. Note, though, that in the current implementation of delete() the value half is unused, the deletion is by the member. In future implementation this behavior may change so that also the value matters.

There are a couple of additional methods:

    %ve = $s->valued_members;

which returns the member-value pairs, and

    @v  = $s->values;

which returns just the values (in the same order as the members() method would return the members), and

    $v  = $s->value($member);

which returns the value of the member.

The display format of a valued set is the member-value pairs separated by " => ", the pairs separated by ", " and enclosed in curly brackets {}.

Jarkko Hietaniemi <jhi@iki.fi>
2014-03-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.