On 7 June 2010 11:44, Yossi Itzkovich <[email protected]> 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
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl