Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^3: Problem with ampersand and regex

by roboticus (Chancellor)
on Dec 19, 2012 at 22:25 UTC ( #1009653=note: print w/replies, xml ) Need Help??

in reply to Re^2: Problem with ampersand and regex
in thread Problem with ampersand and regex

The '@' isn't a problem when you read it from a file. Only if you're using it in a double-quoted string. For example:

$ cat #!/usr/bin/perl use strict; use warnings; my @array = <DATA>; foreach my $line (@array) { if ($line =~ /mail: /) { my $mail = substr($line, $+[$#+] ); print "mail=$mail\n"; } } __DATA__ This @ should be just fine mail: this @ should also be fine $ perl mail=this @ should also be fine


When your only tool is a hammer, all problems look like your thumb.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2016-10-22 02:41 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.