in reply to Regular expressions
You already have some good answers, but here is another that just reverses your search (ie instead of searching for a-zA-Z it searches for anything that is not a-zA-Z and negates the answer):
$temp2 !~ m/[^a-zA-Z]/
This will return false if it finds a character that is not a-z or A-Z. The [^ ] only matches if none of the characters contained in the brackets are found.
You could reverse your condition to make the code easier to read with this method:
if ($temp2 =~ m/[^a-zA-Z]/) { die "Wrong input"; } else { $naam = $1; }
- Cees
|
|---|