My feeble reading of `perldoc -f eval' seems to indicate that both of
the below uses should produce the same thing. They don't and I'm
having trouble understanding why.

  cat one.pl
  #!/usr/local/bin/perl -wp

  BEGIN { our($in,$out,$arg) = (shift,shift) }
    eval "s/$in/$out/";
  -- 
Usage results:
  echo "something nice"|./one.pl '(some)(thing)(.*$)' 'no$2 unusuual'

==================================================================

cat file
  something nice

cat two.pl
  #!/usr/local/bin/perl -w

  $in = shift;
  $out = shift;
  open(FILE,"<stuff");
  while(<FILE>){ 
   eval  $_ =~  s/$in/$out/;
  }

  -- 
  Usage results:
  ./two.pl '(some)(thing)(.*$)' 'no$2 unusuual'
  <nothing>

Its apparent I'm missing something basic eval...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to