
Oh My Glob - kamaal
http://hoelz.ro/blog/oh-my-glob
======
deckiedan
This is why I refuse to use perl (or SH or derivatives, or haskell, sadly) for
system admin scripts:

A new admin comes along in 3 years time, and doesn't know the difference
between _, \, \_ , $?, $@, $&, $$, or gets confused between [] type ifs and [[
]] ifs and 'test -' type ifs in BASH. Or doesn't know which variety of escape
quotes are needed for which variety of strings.

Python has _so_ much less "non-alphanumeric semi-random-combo" syntax.

Even though often a 3 line perl script would do the job, I prefer a 20 line
python script that is easy to grok.

~~~
DHowett
I understand what you're getting at, but...

    
    
        A new admin comes along in 3 years time, and doesn't know the difference(...)
    

...just makes it feel like you're optimizing for the lowest common
intelligence.

It's not a mark on the language but rather one on the understanding of your
potential successor. Would the same sysadmin who is unfamiliar with [[ vs [,
or $ vs @, be handily equipped to do common system administration tasks?
Rebuild a degraded software RAID array? Troubleshoot a faulty network
interface? Chances are comparatively slim.

~~~
noptic
Sorry but sounds awfully arrogant.

Lowest common intelligence? Sounds like anyone unfamillar with perl is stupid.

Perl is very different from other languages an has a very special syntax. The
only way to REALLY understand perl is reading and writting lots of perl code
from different authors.

In perl nearly every problem can be solved in many different ways.

If you are used to one style of perl you might still have trouble
understanding the code someone else wrote.

~~~
Mithaldu
> Lowest common intelligence? Sounds like anyone unfamillar with perl is
> stupid.

No, someone who uses things they don't understand without looking at the
documentation is stupid. One could similarly make such comments about the user
interfaces of vi or emacs, and get the justified response to RTFM. Only in
programming languages is RTFM apparently not expected.

> The only way to REALLY understand perl is reading and writting lots of perl
> code from different authors.

No, the way to understand Perl is to read the documentation. There is nothing
special to Perl about this and the same applies to any language. Just look for
example at how many blog posts are written to explain with() and decorators in
Python.

> In perl nearly every problem can be solved in many different ways.

The same is true for any language.

> If you are used to one style of perl you might still have trouble
> understanding the code someone else wrote.

Only if you don't read the documentation.

~~~
GotAnyMegadeth
> someone who uses things they don't understand without looking at the
> documentation is stupid

I disagree, that's sometimes the best way to learn something. I learnt C, Java
and Perl just by ploughing in without reading anything. Change something, see
what happens, if it doesn't make sense ask Google.

Also programming languages aside, I never read computer game manuals before
playing

~~~
Mithaldu
If you'll allow me a bit of pedanty, that's learning and playing, not using.
:)

I learned Perl the same way and play my games the same way, but when i write
code that'll be used for anything that isn't frivolity, out comes the
documentation to ensure the code doesn't destroy cash (or worse, lives) by the
fistful.

~~~
GotAnyMegadeth
Good point. If someone's life depended on it, I probably would read the Street
Fighter manual, just in case

------
10098
Was expecting a picture of LSP somewhere in the post, left disappointed :(

~~~
hoelzro
I've added one due to popular demand. =)

------
kanatohodets
Great article! Wish I'd found it a few months ago when I was reading HOP and
trying to wrap my head around subroutine installation using globs.

One of my favorite design elements of perl is the ability to lexically declare
"Ok, now for some magic!" (aka "no strict 'refs';") while keeping strict
checking in effect throughout the rest of the code.

------
jgalt212
Lately, there seems to be an uptick in Perl posts on HN. Does anyone else
notice this? Is something afoot amongst the monks?

------
justbaker
Oh my glob an AdventureTime reference on HN..

