|
|
| There's more than one way to do things | |
| PerlMonks |
Re: Matching @ in stringby erroneousBollock (Curate) |
| on Nov 22, 2007 at 13:24 UTC ( [id://652365]=note: print w/replies, xml ) | Need Help?? |
|
perl -e 'if ("h@t" =~ /(\@)/ ) { print $1 }'"h@t" looks to Perl like you're trying to interpolate the array @t (the previous case doesn't because the quote ends the string early. perl -e 'if ("h\@t" =~ /(\@)/ ) { print $1 }'
perl -e 'if (\'h@t\' =~ /(\@)/ ) { print $1 }' should work fine. Update: err, ooops :-) -David
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||