Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Perl splitting help


You guys are basing your judgements on toy fragments of programs. When the job
is so simple that even awk could do it, the only recourse for one-upsmanship is
to try to make it look snazzy by reducing line count, thus leading to justified
accusations of obsfucation.

When you write real-world programs, then you see the power of Perl. I use Perl a
lot for networking utilities and processing binary data. Here are some small
programs I have written in Perl:

Utility to recover files from a CP/M diskette
Print spooler client
Wake-on-LAN client
Netboot tagged image creator
Netboot tagged image disassembler
Partition table dumper
Utility to take a table of NICs and drivers and generate a Makefile
Convert bootptab to dhcp.conf

The longest module is about 600 lines, most are 100 lines or under.

I wouldn't even try to do them in C. Perl handles byte-ordering problems
elegantly with the pack/unpack functions. I consider the code easier to maintain
than because it is concise and doesn't require me to scroll up and down the
screen to get enough context. All this without giving up structured control flow
or functional decomposition just for the sake of obsfucation.

------------------------------------------------------
This mail sent via NLC WebMail: http://www.nlc.net.au/