It's ensuring that shift is being evaluated as a function call and not as a literal string.
But the only case where that can occur is when the function name might be subject to autoquoting. For instance, on the left hand side of a fat arrow. But all we have here is a thin arrow.
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.
Look again at the original code. The return value of the shift is not treated as a class or an object. Look what's following the arrow: not a method name! The return value of the shift is considered to be a subroutine reference (could be a closure).
Examples:
Examples that have nothing to do with the original code. And the + doesn't do what you imply either. Classname->new() is only going to do a call to Classname::new() if there isn't a Classname() subroutine in the currect package. And a + isn't going to change that:
#!/usr/bin/perl use strict; use warnings; package Class; sub foo {"Hello, world"} package Evil; sub foo {"All your base are belong to us"} package main; sub Class {"Evil"} sub bar1 {Class->foo} sub bar2 {+Class->foo} sub bar3 {"Class"->foo} print bar1, "\n"; print bar2, "\n"; print bar3, "\n"; __END__ All your base are belong to us All your base are belong to us Hello, world

In reply to Re^2: What is the + in +shift doing here? by Anonymous Monk
in thread What is the + in +shift doing here? by tphyahoo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.