I'm learning the intermediate perl.In that now I'm studying about the object references for class.In that they gave one package
{
package Barn;
sub new { bless [], shift }
sub add { push @{ +shift }, shift }
sub contents { @{ +shift } }
sub DESTROY {
my $self = shift;
print "$self is being destroyed...\n";
for ( $self->contents ) {
print ' ', $_->name, " goes homeless.\n";
}
}
}
in this I can't understand the work of plus sign with shift operator. In text they said ,the plus sign is like bareword it would be interpreted as a soft reference: @{"shift"}
can you anybody clearly explain its work for using plus sign with shift operator?