<div dir="ltr"><br><br><div class="gmail_quote">On 7 June 2010 11:44, Yossi Itzkovich <span dir="ltr"><<a href="mailto:Yossi.Itzkovich@ecitele.com">Yossi.Itzkovich@ecitele.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">When I give the input: "$input"
(without the quotes) it finds nothing.</p></div></div></blockquote><div>$ is matched as the end of line assertion.</div><div><br></div><div>BTW, if you want to match a literal $ every time (i.e. fgrep semantics), match this pattern:</div>
<div><br></div><div> /\Q$input\E/</div><div><br></div><div>or use quotemeta()</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-US" link="blue" vlink="purple">
<div><p class="MsoNormal">But when I give "\$input" it
finds all "input", even in line 15.</p></div></div></blockquote><div>i can't reproduce this with your script. it matches other lines though:</div><div><br></div><div><div>Enter a pattern:\$input</div><div>chomp (my $input=<STDIN>);</div>
<div>#print "input=$input.\n";</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>print if /$input/;</div><div><br></div><div>but of course these all contain literal $'s</div></div></div>
</div>