The \Q and \E presume that $pat is just a string, not a regex. So you would want to escape any special characters (like '.' or '+' ) and the o tells Perl that $pat isn't going to change in the loop, so it won't keep recompiling the pattern.# change: print $buffer[0] if /$pat/; # to: print $buffer[0] if /\Q$pat\E/o;
In reply to Re: Re: print line 5 lines previous to comaprison line!
by Adam
in thread print line 5 lines previous to comaprison line!
by pat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |