Always use use strict; use warnings;!
should bemy $line = "mail: asdf@123.com";
my $line = 'mail: asdf@123.com';
Then you can simply use
if (my ($mail) = $line =~ /mail: (.*)/) { print "mail=$mail\n"; }
In reply to Re: Problem with ampersand and regex
by ikegami
in thread Problem with ampersand and regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |