You might want to consider evaluating $input once, as it doesn’t seem to change.
Best Regards, Dov Levenglick SmartDSP OS Development Leader From: [email protected] [mailto:[email protected]] On Behalf Of Yuval Kogman Sent: Monday, June 07, 2010 13:04 To: Perl in Israel Subject: Re: [Israel.pm] What is happening here (or -why) ? 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
