There was so much complexity hidden behind "do what I mean". For example, scalar vs array context which was super subtle:
my @var = @array # copy the array
my $var = @array # return the count of elements in arrayIt's funny, because something like
array var = array # copied
int var = array # length
or var = array # copied
var = array.to_i # length
is less subtle to me but I can't put my finger on why.That's not super subtle any more than it's super subtle that "*" performs multiplication and "+" performs addition. Sometimes you just need to learn the language.
This is not a general defense of Perl, which is many times absolutely unreadable, but this example is perfectly comprehensible if you actually are trying to write Perl and not superimpose some other language on it.*
What exactly is complex or "super subtle" about this? It's the textbook example from the 1st chapter in the tutorial or something?
I always found contextual eval interesting. It's a generalized version of toString in a way
It's not complexity, it's magic. Useful when one cannot be bothered to write array.length. So is if (@a) when the array is empty.
Or even worse:
Which allegedly got a HS kid in hot water[^1].[^1]: "It's all about context" (2001): https://archive.ph/IB2kR (http://www.stonehenge.com/merlyn/UnixReview/col38.html)