LWN.net Logo

On the future of Perl 5

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)

On the future of Perl 5

Posted Dec 3, 2008 20:05 UTC (Wed) by jzbiciak (✭ supporter ✭, #5246) [Link]

In fact, C showed oodles of years ago that no variable prefixes are needed at all
That whippersnapper? What about COBOL? Algol? FORTRAN?

On the future of Perl 5

Posted Dec 4, 2008 0:16 UTC (Thu) by salimma (subscriber, #34460) [Link]

Don't forget Lisp.

On the future of Perl 5

Posted Dec 4, 2008 0:27 UTC (Thu) by jzbiciak (✭ supporter ✭, #5246) [Link]

Can you believe that all of those are 50 years old, except for COBOL, which gets that distinction next year?

On the future of Perl 5

Posted Dec 3, 2008 20:16 UTC (Wed) by dlang (✭ supporter ✭, #313) [Link]

only a handlful of the puctuation variables are commonly used, so it's not like you need to memorize all of them.

On the future of Perl 5

Posted Dec 3, 2008 22:25 UTC (Wed) by rgmoore (✭ supporter ✭, #75) [Link]

And you can use English; if you would rather use $INPUT_RECORD_SEPARATOR rather than $/ (or if you get $/ confused with $\).

On the future of Perl 5

Posted Dec 3, 2008 22:35 UTC (Wed) by jengelh (subscriber, #33263) [Link]

INPUT_RECORD_SEPARATOR, wait, they should have called that use Cobol;

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds