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

Re^3: Problem with ampersand and regex

by roboticus (Canon)
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 t.pl #!/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 t.pl mail=this @ should also be fine

...roboticus

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-09-30 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (377 votes), past polls