|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hopefully a very simple question this, but I have a file I'm reading and I want to check that some of the fields are actually numeric [or characters for that matter] for validation.
How can I do this? |
|
#2
|
|||
|
|||
|
You match your string against a pattern that defines your kind of numbers.
If you want to know if a string is an integer you write $mystring =~ /^d*$/ or die "$mystring is not an integern"; |
|
#3
|
|||
|
|||
|
>If you want to know if a string is an integer you write
>$mystring =~ /^d*$/ or die "$mystring is not an integern"; That's great thanks very much! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > When is a numeric a numeric?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|