[...]
>> Perl doesn't have 'data structures' it has various kinds of objects
>> and references to objects.
[...]
> Perl has data structures. They are the things described in perldsc, the
> Perl Data Structures Cookbook. Perl also has objects, which are
> something rather different, and are not covered in Tye's tutorial.
This will probably earn me the 'pedantic' accusation again but so be
it: I was using 'object' in the sense it is used in the C standard,
for want of a better term for that: It's meaning is roughly "some
typed thing which can be allocated, deallocated and deal with directly
by code written in $language". The term 'first class citizen' is also
used to refer to that. In Perl, a behavioural definition of 'object'
in this sense could be "something the \-operator can be applied to [if
it isn't anonymous]", ie, scalar, arrays, hashes, subroutines, globs
and a few more, less common somethings. Another definition could be
'something which is either a glob can be "stored" in a glob slot'.#
In hindsight, I understand that the author of this 'cheat sheet'
intended to partition the set of perl objects into 'proper' and
'fishy' ones, presumably based on experiences with
$other_programming_language, however, that wasn't obvious to me when
reading the text and I also disagree with this partitioning. I use
anonymous subroutines, mostly closures, very frequently, and I also
write code which generates code at runtime frequently. Perl support
for the latter is fairly poor because it requires generating source
code text and running that through the compiler via eval but
nevertheless existant and useful: subroutines are almost 'first class
citizens' in Perl.
I've been doing an unholy amount of Java programming recently and some
things which are very simple in Perl, eg, write a general
'structured thing' comparison routine, are hideously complicated in
Java because its support for treating 'functions' as 'objects' is even
poorer than that of C (I have such a routine with a limited scope and
the code necessary to invoke that is only about 50% less than the
comparison code itself): Perl is a nice language because of its more
uncommon (in 'mainstream programming languages') features, not a nice
language despite of them because it enables people to build
punctuation cascades capable of reducing grown men to tears and
routinely outclevering everyone (including themselves) in the
process.