On the future of Perl 5
Posted Dec 3, 2008 19:19 UTC (Wed) by
jengelh (subscriber, #33263)
In reply to:
On the future of Perl 5 by clugstj
Parent article:
On the future of Perl 5
Variable prefixes are actually simple ($ one, @ many). What is much more mind-boggling with Perl5 are all the puncutation variables: $! $" $$ $% $^ $& $* $( $) $[ $] ${ $} $< $gt; $. $_ $, $-, etc. you name it. With Perl6, even more hell breaks loose as they add a load of new operators.
You mention variable prefixes, right, probably referring to PHP which uses $ everywhere. Well, you can also use $ everywhere in Perl, just make a ref/pointer instead of an array:
@foo = (1..9);
$foo = [1..9];
Oh yeah that leads to another thing. The choice of ( [ { } ] ) for list, arrayref and hashref. I really prefer PHP here which instead uses a function-style prefix, array(), and which also uses square brackets to indicate both index, and key name: $x[0] $x["foo"].
In fact, C showed oodles of years ago that no variable prefixes are needed at all. Coincidentally, having to predeclare all variables used makes for a better typo-resistant program. Yes, Perl has use strict to do the same, luckily, but other P languages don't seem to.
(
Log in to post comments)