my $eingabe = '1-3 5 8 9-10'; my @a = split(m/[-\s]/, $eingabe); print join(', ', @a);