"Ned Cunningham" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> HI all.
>
> I am trying to verify that a field has only numbers
>
> 12345
> 13456
> 34x34
>
> if it has non numbers I want to delete the non number with a zero?
>
> Snip
>
> $mil =~ s/[0-9]/$_/;
>
> this returns zero.
>
> Any help?
>

my $string = "123";
if (my $number_of_changed_chars = ($string =~ s/\D/0/g) ) {
   print "changes found\n";
   print "==> $string\n";
   print "num $number_of_changed_chars\n";
}

\D = Not a digit

HTH

Rob

>
> Ned Cunningham
> POS Systems Developer
> Monro Muffler Brake & Service
> 200 Holleder Parkway
> Rochester, New York 14615
>  (585) 647-6400 ext 310
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to