[Israel.pm] What is happening here (or -why) ?
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:
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 if /$input/;
but of course these all contain literal $'s
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Perl