[oak perl] Applying shift() to an array reference

David Alban extasia at extasia.org
Thu Sep 15 17:17:17 PDT 2005


On 9/15/05, steve kolupaev <skolupae at sonic.net> wrote:
>    shift @{$ar};          # the array is down to 8 scalars
>    shift @$ar;            # the array is down to 7 scalars

shift() is not operating on the reference, but on the dereferenced
array.  If shift() were given the array ref itself, we'd get:

  Type of arg 1 to shift must be array (not private variable)

Perhaps they're not familiar/comfortable with the way perl does
dereferencing?  I.e., $ar is a scalar, @$ar is an array...

-- 
Live in a world of your own, but always welcome visitors.


More information about the Oakland mailing list