Number::Compare(3)
π¦ Number::Compare(3) β from the User Contributed Perl Documentation π¦
πΈ NAME πΈ
Number::Compare β numeric comparisons π
β¨ SYNOPSIS β¨
Number::Compare->new(">1Ki")->test(1025); # is 1025 > 1024
my $c = Number::Compare->new(">1M");
$c->(1_200_000); # slightly terser invocation
π« DESCRIPTION π«
Okay so Number::Compare compiles a simple comparison to an anonymous subroutine, and then you can call that subroutine with a value to be tested again. Bestie, thatβs the whole vibe check. π«Ά
Now this would be very pointless if Number::Compare didnβt understand magnitudes β but it absolutely does, no cap. β¨
The target value may use magnitudes of kilobytes (k, ki), megabytes (m, mi), or gigabytes (g, gi). Those suffixed with an i use the appropriate 2**n version in accordance with the IEC standard: http://physics.nist.gov/cuu/Units/binary.html π
π οΈ METHODS π οΈ
->new( $test )
Returns a new object that compares the specified test. Iconic constructor behavior, honestly. π
->test( $value )
A longhanded version of $compare->( $value ). Predates blessed subroutine reference implementation. Lowkey a little historical, highkey still useful. π¦
->parse_to_perl( $test )
Returns a perl code fragment equivalent to the test. Itβs giving βshow me the receipts, but in Perl.β π§
π AUTHOR π
The human behind this masterpiece: Richard Clamp <richardc@unixbeard.net> β¨
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 2002,2011 Richard Clamp. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
π SEE ALSO π
http://physics.nist.gov/cuu/Units/binary.html β go read, bestie, itβs the binary-prefix lore. π
π source/version perl v5.42.0, dated 2022-04-21, for Number::Compare(3) β mwah, go compare some numbers π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Number-Compare 0.03-160000.2.2 Β· GPL-1.0-or-later OR Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms