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
Getopt::EX::Numbers(3) User Contributed Perl Documentation Getopt::EX::Numbers(3)

Getopt::EX::Numbers - module to handle number parameters

use Getopt::EX::Numbers;

my $obj = Getopt::EX::Numbers->new(max => 100);

$obj->parse("start:end:step:length"); $obj->range;

$obj->parse("start:end:step:length")->sequence;

Getopt::EX::Numbers->new->parse("1:10:2")->sequence;

Number format is composed by four elements: "start", "end", "step" and "length". All elements are optional.

    1           1
    1:3         1,2,3
    1:20:5      1,     6,     11,       16
    1:20:5:3    1,2,3, 6,7,8, 11,12,13, 16,17,18

When "start" is omitted, minimum value is used, which is zero by default. If the object is initialized with "max" value, "end" element can be omitted.

    ::          all
    ::2         even numbers
    1::2        odd numbers

If "start" and "end" number is negative, they are subtracted from the maximum number. If the "end" number is prefixed by plus (`+') sign, it is summed to "start" number. Next examples produce top and last 10 numbers.

    :+9         top 10 numbers
    -9:         last 10 numbers

new ( [ min => n ] , [ max => m ] )
Create object with optional parameter min and max.
parse(spec)
Accept number description and parse it. Return object itself.
range
Return number range list:

    ( [ n0, m0 ], [ n1, m1 ], ... )
    
sequence
Return number sequence:

    ( n0 .. m0, n1 .. m1, ... )
    
2019-09-03 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.