Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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.

Comment on Re^3: Problem with ampersand and regex
Download Code

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 chanting in the Monastery: (8)
As of 2015-11-25 22:48 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (692 votes), past polls