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.

I also had the problem (at first) with the array slice. I thought initially that it was a sigil issue and an issue with semantics. (As you have explained)

But, I noticed that I did not have the issue with a hash. It seemed to me that if the sigil was causing me to have a semantic problem that the problem would carry to other cases... but, in my case... it did not.

So, I thought about it some more. Then, I realized that I didn't have the issue with the hash because I would get an immediate error if I tried to do it with the hash.

But, I was NOT getting that kind of feedback with the array... because sometimes the thing "Just Works" like you want it to. Even tho you asked for something else... what you go was useful.

So, the "problem" got reinforced.

In the end, I solved it by thinking first about WHAT I wanted... I wanted a single scalar. Those are denoted by '$'. Next I think... OK, what is the name of the variable holding the data... then I'm done if the variable is in a scalar.

Or, I mentally treat the [] and {} as sigils to indicate that the variable HOLDING the data is an array or a hash.