in reply to What is the + in +shift doing here?
It's ensuring that shift is being evaluated as a function call and not as a literal string. You don't want 'shift' to be seen as a class name, you want it to be evaluated as a function call, and its return value to be used as the class name or object reference.
Examples:
my $object = Classname->new(); # Classname is seen as a class name # and new() is a method of Classname. my $gotten = +subname->new(); # Here subname had better return # either a valid class name or an # object capable of having new() # called as an object method.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is the + in +shift doing here?
by Anonymous Monk on Feb 24, 2005 at 10:54 UTC |