if ( $conphone =~ /(\d{3})-(\d{3})-(\d{4})/ ) { print "Phone: $conphone\n"; } else { print "BAD PHONE!!!! BAD PHONE!!!!\n"; }