Why bash+awk+sed+..., when you can use Perl? ;)
-
Upload
luciano-rocha -
Category
Technology
-
view
1.602 -
download
2
Transcript of Why bash+awk+sed+..., when you can use Perl? ;)
![Page 1: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/1.jpg)
Why bash+awk+sed+..., when you can use Perl? ;)
Luciano Rocha
June 6th, 2008
![Page 2: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/2.jpg)
Introduction
1 There can be only one!
2 Why reinvent the wheel?
3 No more glue!
4 Vrooom!
![Page 3: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/3.jpg)
There can be only one! (or, Portability)
Perl is more portable!
Different operating systems have different versions of the basic tools:
Is /bin/sh bash? dash? ...?
Does ‘xargs -r’ work?
Does ‘find’ assume ‘.’? Does it have the printf formats you need?
Does ‘sed -i‘ work?
Must options always come first?
![Page 4: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/4.jpg)
Why reinvent the wheel? (or, Work intelligently)
Use other people’s work
Extensive documentation with great examples.
CPAN is huge!
Cookbooks!
![Page 5: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/5.jpg)
No more glue!
Getting tired of typing long lines?
If you’re going to write a script, use a portable and powerful language.And don’t depend on external commands that may not work the samebetween platforms, breaking your scripts.
![Page 6: Why bash+awk+sed+..., when you can use Perl? ;)](https://reader035.fdocuments.us/reader035/viewer/2022071721/55b15333bb61eb80258b4694/html5/thumbnails/6.jpg)
Vrooom! (or, It’s fast)
Perl is faster
Ignoring start overhead, the same algorithms will be faster in Perl than in acombination of shell, sed, awk and other things.
Don’t torture yourself
A proper programming language, with associative arrays, most of POSIXfunctions, and a extensive library.