Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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 browsing the Monastery: (5)
As of 2016-05-30 13:06 GMT
Find Nodes?
    Voting Booth?