On 6/4/02 10:26 PM, "Adam Vardy" <[EMAIL PROTECTED]> wrote:
> Can someone help please. I'm learning from scratch. What is this? > > $_='My email address is <[EMAIL PROTECTED]>.'; Sets the magical Perl variable $_ to equal the scalar value: My email address is <[EMAIL PROTECTED]> > /(<.*>)/i; This is what's called a regular expression. Because it's not bound to a particular variable using the =~ notation, it automatically tries to make a match with whatever's in the magical $_. The slashes are the delimiters of the match; you're trying to match what's inside the slashes. The metacharacter "." matches any character; the quantifier "*" matches 0 or more of the preceding character -- in this case, any character. The angle brackets are regular characters. Therefore, the regular expression is trying to match any characters within angle brackets -- i.e., your e-mail address. The parentheses around the regular expression (here, the entire match, but it could be just a portion of a larger regular expression) capture whatever is matched for later use; this portion is stored in another special Perl variable, $1. > print "Found it ! $1\n"; The print function prints "Found it! ", followed by the pattern that was captured (<[EMAIL PROTECTED]>), capped off by a newline. > I can only identify one command here. Print. How does this 'program' > run? HTH. And I'm reasonably new at this too, so if I got something wrong, hopefully someone who knows what they're doing will correct me. - geoff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]