Adding range support.
This commit is contained in:
parent
599493ac7b
commit
d7a80c2c47
@ -5,6 +5,6 @@
|
||||
Perl 5.36.0 or later is required to run this script.
|
||||
|
||||
```shell
|
||||
perl number_generator.pl <The desired number to convert into text>
|
||||
perl number_generator.pl <start of range> <end of range>
|
||||
|
||||
```
|
||||
|
@ -12,11 +12,17 @@ my @numbers_one_to_nineteen = (@numbers_one_to_nine, qw/ten eleven twelve thirte
|
||||
|
||||
my @decenes = (undef, qw/twenty thirty forty fifty sixty seventy eighty ninety/);
|
||||
sub main {
|
||||
my $number = $ARGV[0];
|
||||
if (!defined $number) {
|
||||
$number = 1_111_111;
|
||||
my $start_of_range = $ARGV[0];
|
||||
my $end_of_range = $ARGV[1];
|
||||
if (!defined $end_of_range) {
|
||||
$end_of_range = 9_999_999;
|
||||
}
|
||||
if (!defined $start_of_range) {
|
||||
$start_of_range = 0;
|
||||
}
|
||||
for (my $i = $start_of_range; $i <= $end_of_range; $i++) {
|
||||
say convert_number_to_words($i)
|
||||
}
|
||||
say convert_number_to_words($number)
|
||||
}
|
||||
|
||||
sub convert_number_to_words($number) {
|
||||
|
Loading…
Reference in New Issue
Block a user