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

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -