Hacker News new | ask | show | jobs
by matthewpersico 1510 days ago
Because Perl is context sensitive and what we care about is not what is being stored but what is being accessed.

'array' is the variable.

'@array' gives me the list in 'array'.

'$array[1]' gives me the scalar ($) value at array[1].

`@array[3..7]` gives me the list (@) of values at array indexes 3-7, inclusive on both sides. (Why does Python use open ended ranges? <facepalm>) (Why is Python's slicing syntax an inflexible loop? <facepalm again>)

`@array[1]`, by the way gives me the list of values at array index 1, which is the same as `$array[1]`