1Number::Compare(3) User Contributed Perl Documentation Number::Compare(3)
2
3
4
6 Number::Compare - numeric comparisons
7
9 Number::Compare->new(">1Ki")->test(1025); # is 1025 > 1024
10
11 my $c = Number::Compare->new(">1M");
12 $c->(1_200_000); # slightly terser invocation
13
15 Number::Compare compiles a simple comparison to an anonymous
16 subroutine, which you can call with a value to be tested again.
17
18 Now this would be very pointless, if Number::Compare didn't understand
19 magnitudes.
20
21 The target value may use magnitudes of kilobytes ("k", "ki"), megabytes
22 ("m", "mi"), or gigabytes ("g", "gi"). Those suffixed with an "i" use
23 the appropriate 2**n version in accordance with the IEC standard:
24 http://physics.nist.gov/cuu/Units/binary.html
25
27 ->new( $test )
28 Returns a new object that compares the specified test.
29
30 ->test( $value )
31 A longhanded version of $compare->( $value ). Predates blessed
32 subroutine reference implementation.
33
34 ->parse_to_perl( $test )
35 Returns a perl code fragment equivalent to the test.
36
38 Richard Clamp <richardc@unixbeard.net>
39
41 Copyright (C) 2002,2011 Richard Clamp. All Rights Reserved.
42
43 This module is free software; you can redistribute it and/or modify it
44 under the same terms as Perl itself.
45
47 http://physics.nist.gov/cuu/Units/binary.html
48
49
50
51perl v5.12.4 2011-09-21 Number::Compare(3)