I am currently reviewing Perls RegExps and generally understand what I think. Escaping characters that I also understood, such as testing for a backslash, denoted by m / \ /, is that the backslash should continue, buy the \ character first to tell perl in this case, to find it like it has been attributed to the usual meaning.
What I donβt understand with the code below is the match of this pattern and why (\) is used when testing the email address with @symbold (in the if statement). I donβt know that @ is a special character who needs to slip away or am I missing something?
#!/usr/bin/perl EMAIL: { print("Please enter your email address: "); $email = <STDIN>; if ($email !~ /\@/) { print("Invalid email address.\n"); redo EMAIL; } else { print("That could be a valid email address."); } }
regex perl escaping
Mike thornley
source share