[Israel.pm] What is happening here (or -why) ?
Yuval Kogman
nothingmuch at woobling.org
Mon Jun 7 03:04:10 PDT 2010
On 7 June 2010 11:44, Yossi Itzkovich <Yossi.Itzkovich at ecitele.com> wrote:
> When I give the input: "$input" (without the quotes) it finds nothing.
>
$ is matched as the end of line assertion.
BTW, if you want to match a literal $ every time (i.e. fgrep semantics),
match this pattern:
/\Q$input\E/
or use quotemeta()
> But when I give "\$input" it finds all "input", even in line 15.
>
i can't reproduce this with your script. it matches other lines though:
Enter a pattern:\$input
chomp (my $input=<STDIN>);
#print "input=$input.\n";
print if /$input/;
but of course these all contain literal $'s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100607/b398ed1a/attachment.htm
More information about the Perl
mailing list