All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

He is mostly just complaining about the syntax. So, he is saying that:

${$arrayRef}[0]=4;

Is uglier than (I agree):

array[0]=4;

And

$x=func(1,\@array);

Is uglier than (meh):

x=func(1,array)

Reference handling is one of the few things I really don't like about Perl. In a high level language like Perl, you shouldn't have to worry about what's a reference what isn't (most of the time). It goes against DWIM.

He also complains about having to change the prefix on the array to access the individual element.

I like that you have to specify that you're passing a reference. I like that by default, perl flattens arrays into the argument list. I seem to do that more often than passing in references. When I was playing with Ruby, a gotcha for me was that you had to add extra syntax to flatten the array in an argument list. So what are these people complaining about? You gotta have it one way or the other, I like the perl way, but I could adjust to t

Though I forgot one of the points of this whole thread was about passing by reference...oh well. I hardly ever want to do that anyway except in OO programming. And in perl, objects are always references.