Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 wandering the Monastery: (12)
As of 2014-12-27 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls