Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Problem with ampersand and regex

by ikegami (Pope)
on Dec 19, 2012 at 23:24 UTC ( #1009660=note: print w/ replies, xml ) Need Help??


in reply to Problem with ampersand and regex

Always use use strict; use warnings;!

my $line = "mail: asdf@123.com";
should be
my $line = 'mail: asdf@123.com';

Then you can simply use

if (my ($mail) = $line =~ /mail: (.*)/) { print "mail=$mail\n"; }


Comment on Re: Problem with ampersand and regex
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2015-07-29 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls