You're interpolating $input with a value such as '../log.dummy-10-01-06-05.gz' into the pattern m#PROCESSING ../$input#. After the interpolation, that's m#PROCESSING ../../log.dummy-10-01-06-05.gz#. That's different from the working pattern you had before (m#PROCESSING ../log.dummy-10-01-06-05.gz#).
One thing you'll want to do, since you're matching literal strings, is to use quotemeta or \Q in the pattern. As it is, when you interpolate $input, the initial dots in '../log.dummy-10-01-06-05.gz' could match any character (as they normally would in a regexp).
In short, I think you want this:
m#PROCESSING \Q$input#
If I may make a few more suggestions...
- Please don't use # as delimiters. It really plays havoc with my context-sensitive editor. I personally like m{}.
- Since you're looking for literal strings, index would be faster (but maybe harder to read).
- Use three argument open: open my $zcat_fh, '-|', "zcat $filename" or die ...
- Have a look at Writeup Formatting Tips. Specifically, you need <code> tags around your code to make it look right.
- If you don't already, use strict and warnings.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.