use strict; use warnings; my $string = '99999999999999999999999999'; my $string2 = '9-999-999-999-999-999-999-999-9999'; # see Note 1 below if ( $string =~ /^(\d)(\1|-)+$/ ) { print "\$string might be a phone number: $string \n"; } else { print "$string is NOK \n"; } if ( $string2 =~ /^(\d)(\1|-)+$/ ) { print "\$string2 might be a phone number: $string2 \n"; } else { print "$string2 is NOK \n"; } print "stiller's snippet: \n"; my $num = 999999999; print sprintf("%f\n",$num); print sprintf("%d\n",$num);