[Israel.pm] What is happening here (or -why) ?

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Mon Jun 7 01:44:34 PDT 2010


Hi,
I have this simple grep-like program:

1  #! /bin/env perl
     2  use warnings;
     3  use strict;
     4  #use re 'debug';
     5
     6  print "Enter a pattern:";
     7  chomp (my $input=<STDIN>);
     8
     9  @ARGV=$0;
    10  #print "input=$input.\n";
    11  while (<>)
    12    {
    13      print if /$input/;
    14    }
    15 #input

When I give the input:  "$input"  (without the quotes) it finds nothing. But when I give "\$input" it finds all "input", even in line 15.
What is going on ?

Yossi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20100607/e3fd6c35/attachment.htm 


More information about the Perl mailing list