Convert::Number::Greek - Convert between Arabic and Greek numerals
Version 0.02
use Convert::Number::Greek qw'num2greek greek2num'; $greek_number = num2greek 1996; # $greek_number now contains # "\x{375}\x{3b1}\x{3e1}\x{3df}\x{3db}\x{374}" $number = greek2num "\x{3b5}\x{3c3}\x{3c4}\x{3b6}'"; # $number now contains 567
This module provides subroutines for converting between Arabic and Greek numbers.
num2greek converts an Arabic numeral to a Greek numeral in the form of a Unicode string the syntax is as follows:
NUMBER is the number to convert. It should be a string of digits, nothing more (see BUGS, below). OPTIONS (optional) is a reference to a hash of boolean options. The options available are as follows:
Option Name Default Value Description upper 0 Use uppercase Greek letters uc 0 " " " " stigma 1 Use the stigma for 6 as opposed to sigma followed by tau arch_koppa 0 Use the archaic koppa instead of the modern one numbersign 1 Append a Greek number sign (U+0374) to the resulting string
When you specify options, undef is treated as false, so
undef
num2greek $some_number, { uc => 1, stigma }
actually means
num2greek $some_number, { uc => 1, stigma => 0 }
The greek2num function parses a Greek numbers and returns the Arabic equivalent.
greek2num
STRING is a string consisting of a Greek number. Anything following the number will be ignored, but will raise a warning if use warnings 'numeric' is on (unless it's just whitespace).
use warnings 'numeric'
Currently no options are available.
None by default, but you get num2greek and greek2num if you ask for them (politely).
num2greek
The greek2num function will trigger a "non-numeric" warning if you use warnings 'numeric'.
This module requires perl 5.8.0 or later, though the earliest version I have tested it with is 5.8.1.
The num2greek function does not yet have any error-checking mechanism in place. The input should be a string of Arabic digits, or at least a value that stringifies to such. Using an argument that does not fit this description may produce nonsensical results.
Father Chrysostomos <sprout @cpan.org>
To install Convert::Number::Greek, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Convert::Number::Greek
CPAN shell
perl -MCPAN -e shell install Convert::Number::Greek
For more information on module installation, please visit the detailed CPAN module installation guide.