Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2015-11-25 07:32 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls