Chapter 8. Scripting techniques

8.1

Exploiting script-oriented functions

248

8.2

Pre-processing arguments

256

8.3

Executing code conditionally with if/else

259

8.4

Wrangling strings with concatenation and repetition operators

265

8.5

Interpolating command output into source code

269

8.6

Executing OS commands using system

275

8.7

Evaluating code using eval

283

8.8

Summary

292

Those nifty one-line commands you saw in part 1 are easy to type, and they’re adequate for an impressively wide variety of common tasks. And gosh darn it, you might even say they’re cute, if not downright elegant.

But sooner or later, you’ll need to write programs that can validate their arguments, handle arguments that aren’t filenames, capture and manipulate outputs from Unix commands, process inputs ...

Get Minimal Perl: For UNIX and Linux People now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.