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.
|
|---|