Robert said:
chacallot said:
Yes, am disappointed by perl.
It's often the problem that people project their own responsibilities.
The real problem as I see is, for example...
I dont understand why pop couldnt work on an anonymous array returned by
split..
Try to understand the *basics* of a language first. *Then* judge. Of
course you can make judgements as much as you want. But there's no point
unless you know what you're talking about. Without understanding, it's
less worth than a downscored slashdot rant.
You can have
An array:
my @foo = (1, 2, 3); # @foo is the array
A list:
print (1, 2, 3); # (1, 2, 3) is a list
An anonymous array reference
my $foo = [1, 2, 3]; # $foo is the reference
pop only takes an array as argument. You might ask "Why? It's just
returning the last element." Wrong! It's *removing* the last element.
Therefore it needs a container, not a constant value.
my $foo = 1;
$foo++; # works, the container holds the value
1++; # does not work, it *is* the value 1.
my @bar = (1, 2);
pop @bar; # works, the container holds the values, last is
# removed.
pop (1, 2); # can't work. (1, 2) is constant and can't be
# altered.
After seeing that I've wanted to write a sentence and written a bunch
more, I really hope you aren't just the regular day-to-day troll.
p
Hi!
Thx to all those who took some time to answer this. It was not a troll
but some kind of cry of frustration.
Many focused on the pop split thing while it was not really the main
point here but an illustration of a limitation in the "there's more than
one way to do it" thing.
Thanks to your explanations I understood one important perl thing that I
overlooked until now : arrays and list are not the same.
I have looked back at the manuals and I didnt find anyplace where I
could have been warned about that. Specially in perlintro about Arrays,
I read :
"Arrays
An array represents a list of values:"
Then
"You can do various useful things to lists:
my @sorted = sort @animals;"
Reading that I just lazily deduce that list and arrays are two names for
the same thing.
Reading again perldata doesnt help either :
"Perl has three built-in data types: scalars, arrays of scalars, and
associative arrays of scalars"
"There are two major contexts: list and scalar. Certain operations
return list values in contexts wanting a list, and scalar values otherwise"
Am still meditating about how is it that one of the data types is also a
context type (scalar) while the other context type isnt.
Concerning the "sub variable scope" thing (more detailed about that in
the "Variables scope. Am lost..." thread I posted earlier) I still think
that "use strict" or "use warnings" where there to prevent me from doing
such mistake.
Cause if you cant rely on those switches "there's more than one way to
do it" becomes "sometimes it works the way you think, sometimes not :
have fun!"
Concerning CPAN modules, there's too many of them doing more or less the
same thing. Looks to me there's is a lack of collaborative work on
those. It's nearly always one person committing one module. The obvious
consequence of that is that the modules are poorly maintained as the guy
who did it wont stay focused on the thing very long.
Seems there was lots of activity on CPAN between 2000 and 2002 and much
less since then.
Those who tell me that I should just contribute instead of complaining
could be right.
But I chose perl to do sysadmin scripts with the idea this was the
universal language I could use to do Unix and Windows (and maybe others)
sysadmin task without having to spend too much time learning each of the
"genuine" system language.
Now to be able to develop win32 modules, I must first learn VC/VC++ and
the Windows internals. When/if I know enough about those, maybe I'll
be able to use this knowledge to commit the corresponding win32 modules.
But there is many other more interesting subjects I should be working on
and the time I can invest in all those subject is obviously limited...
Rgds,
Chacallot.