Data::Validate::Currency - Module to validate if string is a valid currency format
use strict; use warnings; use Data::Validate::Currency qw( is_currency ); my $currency_string = '$1,000.00'; my $currency_validation = is_currency($currency_string); print "Is a valid currency string\n" if $currency_validation;
Module that takes a string and returns a true or false value if the string is a valid currency. Supports the comma as thousands-separator format, 2 and 3 digit decimals. Dollar sign is optional.
use strict; use warnings; use Data::Validate::Currency qw(is_currency); my $currency_string = '$1,000.00'; my $currency_validation = is_currency($currency_string);
Returns 1 if it is valid currency format, 0 if it is not. Dollar sign optional.
Daniel Culver, perlsufi@cpan.org
perlsufi@cpan.org
Eris Caffee, eris-caffee@eldalin.com - A majority of the credit goes to Eris for the final regex.
eris-caffee@eldalin.com
Robert Stone, drzigman@cpan.org - Robert initially started the regex.
drzigman@cpan.org
HostGator
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Validate::Currency, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Validate::Currency
CPAN shell
perl -MCPAN -e shell install Data::Validate::Currency
For more information on module installation, please visit the detailed CPAN module installation guide.