On Aug 2, Alan C. said:

>#!/perl/bin/perl -w
>use strict;
>#map & join from @ARGV into $pattern snipped
>my $pattern='(?=.*doc)(?=.*sort)';
>#print "$pattern";
>#directory files foreach file to be searched snipped
>if (s/^H=($pattern)/$1/io) {
>      print "$fil:$_" ;
>      }
>#end

>In the map and join line I tried \b
>
>(?=.*\bdoc\b)
>
>but the pattern got messed up, part of the pattern got cut off.

If the map & join line is the one you worked on, why did you omit it from
your code?  Chances are, that's where the problem lies.  Perhaps you used
doubled quotes around that part of the pattern?

  my $pattern = join "", map "(?=.*\b$_\b)", @ARGV;

Is that what your code looks like?  If so, the problem is that \b, in
double quotes, means "backspace".  In order to get around this, you'll
need to either double the backslash, or use different quoting:

  my $pattern = join "", map "(?=.*\\b$_\\b)", @ARGV;
  my $pattern = join "", map '(?=.*\b' . $_ . '\b)', @ARGV;

For reasons that are probably obvious, I prefer the first of those
approaches.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



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

Reply via email to