in reply to Problem with ampersand and regex
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 Section
Seekers of Perl Wisdom