Librenix  
(Show all Perl articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Perl tips

Up
vote
Down

Ten perl one-liner tips and tricks...
The core of any perl one-liner is the -e switch, which lets you pass a snippet of code on the command-line:

perl -e 'print "hi\n"' prints "hi" to the console.

The second standard trick to perl one-liners are the -n and -p flags. Both of these make perl put an implicit loop around your program, running it once for each line of input, with the line in the $_ variable. -p also adds an implicit print at the end of each iteration.
 read more | mail this link | score:8241 | -Ray, June 1, 2010
More Programming articles...

Buy Large Wall Art Prints

coding headlines

No Starch Press has published my Perl One-Liners book!

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin