Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by QM (Parson)
on Jul 16, 2015 at 15:29 UTC ( #1135033=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135033]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2021-10-22 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (85 votes). Check out past polls.

    Notices?