Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Things every perl programmer should know?

by thelenm (Vicar)
on Jun 04, 2003 at 15:51 UTC ( #263037=note: print w/ replies, xml ) Need Help??


in reply to Things every perl programmer should know?

I use Perl for a lot of quick file-munging (and golf :-), so I've found it very useful to be familiar with the command line options as described in perlrun. The -n, -p, and -i options can be particularly handy if you're just running through files doing something to each line. For example, you can replace "foo" with "bar" in every .txt file in a directory with this one-liner:

perl -pi -e 's/foo/bar/g' dir/*.txt

Very simple, but very powerful. Of course you can do more complex things with this as well.

-- Mike

--
just,my${.02}


Comment on Re: Things every perl programmer should know?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2015-07-02 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls