What does shift->{o} = $o; do in Perl? -
what line in subroutine mean?
shift->{o} = $o;
i know shift usualy do, don't understand in context, dash , arrow.
inside sub/method,
shift
is short for
shift(@_)
a sub call places arguments in @_
. method call same, precedes arguments invocant.
if in sub called sub, assigns $o
element o
of hash referenced first argument.
if in sub called method, assigns $o
element o
of hash referenced invocant. effectively, sets attribute o
of object on method called.
in process, shift
removes reference @_
, though suspect might of no consequence.
Comments
Post a Comment