my $c = '+000000'; print 'contains' if $c =~ /^\+\d{6}$/; # or... print 'contains' if $c eq '+'.'0'x6;