in reply to Weird syntax. What does this goto statement do?
Hello harangzsolt33,
From goto:
The goto &NAME form is quite different from the other forms of goto. In fact, it isn't a goto in the normal sense at all, and doesn't have the stigma associated with other gotos. Instead, it exits the current subroutine (losing any changes set by local) and immediately calls in its place the named subroutine using the current value of @_. This is used by AUTOLOAD subroutines that wish to load another subroutine and then pretend that the other subroutine had been called in the first place (except that any modifications to @_ in the current subroutine are propagated to the other subroutine.) After the goto, not even caller will be able to tell that this routine was called first.
NAME needn't be the name of a subroutine; it can be a scalar variable containing a code reference or a block that evaluates to a code reference.
I’ve seen this in the documentation, but never had any need to use it.
Hope that helps,
Athanasius <°(((>< contra mundum | סתם עוד האקר של פרל, |
|
---|