Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^4: Golf Challenge: FizzBuzz

by shmem (Chancellor)
on Mar 12, 2007 at 23:47 UTC ( #604453=note: print w/replies, xml ) Need Help??

in reply to Re^3: Golf Challenge: FizzBuzz
in thread Golf Challenge: FizzBuzz

It contributes to the notion of perl being obscure and hard to read.
For me, it contributes also to the notion that perl is hard to write - summing both: that perl is very sophisticated.

I like golf not only because it reveals dark corners of perl; it also reveals perl's tremendous ability to eliminate noise and produce dense expressions. Ultimately, golf tends to be noise, when shorter statement can not anymore be contrieved, but even those constructs - add a bit of air (white space) to them, a bit more verbosity, and many of them expand into beautiful, perfectly understandable nailing-downs of solutions to the problem at hand.


%hash = (); { my @keys = qw ( a, b, c); my @values = 1..3; for ( my $c = 0; $c <= $#keys; $c++ ) { $hash { $keys [$c] } = $values [ $c ]; } }

which is a common idiom in many languages, to

@hash { qw (a, b, c) } = 1..3;

of which the latter is the golfed code version, useable in production code, and you must admit that perl to some extent is golf - well, compared to Java anyways ;-)

Any language is "obscure and hard to read" for those that don't venture into it; and no matter whether that "obscure and hard to read" judgement is uttered as a pretext to not do so, or as a disinformed dismissive, it is just prejudice - and there being perl golf or not doesn't change that in the least.


_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://604453]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2020-07-15 01:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found