http://qs321.pair.com?node_id=1135033


in reply to How to handle metacharacters in input file for Perl one-liner code

Besides the good advice you've received above, you should also investigate regex anchors ^ and $, for example:
s/^$file$/something goes here/

Search for "anchor" in perlretut#Simple word matching.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: How to handle metacharacters in input file for Perl one-liner code
by debug (Initiate) on Jul 17, 2015 at 06:42 UTC

    Thank you everyone for your excellent suggestions above.

    I will go ahead and replace my shell calls with direct Perl code. Also, QM's anchor suggestion is great, and would probably have helped me in the first place, though I'm kinda glad I did not, since it forced me to figure out the other loophole in my code. I'll go put it in my code now.