Is there a module for parsing numbers (inkl. ranges)?
- by sid_com
Is there a module, which does this for me?
#!/usr/bin/env perl
use warnings; use strict; use 5.012;
sub aw_parse {
my( $in, $max ) = @_;
chomp $in;
my @array = split ( /\s*,\s*/, $in );
my %zahlen;
for ( @array ) {
if ( /^\s*(\d+)\s*$/ ) {
$zahlen{$1}++;
}
elsif ( /^\s*(\d+)\s*-\s*(\d+)\s*$/ ) {
…