in reply to Re^2: 'return:' instead of 'return'
in thread 'return:' instead of 'return'

but it doesn't produce the above warning
That is because in your code, it's the last statement in the sub. So by default, it's the value that is returned, even without a real return.

Replies are listed 'Best First'.
Re^4: 'return:' instead of 'return'
by Boldra (Curate) on Jun 12, 2009 at 10:48 UTC
    And the last statement in a sub seems to be excluded from 'useless use of constant' warnings, I didn't know that.

    However, the other reason I didn't see "Useless use of a constant in a void context" is that my colleagues code has a variable (not a constant) after the 'return:'.


    - Boldra
      And the last statement in a sub seems to be excluded from 'useless use of constant' warnings, I didn't know that.

      It's not exclude. The reason why you don't see this warning, is because a constant as the last statement in a sub is not useless at all.

      -- 
      Ronald Fischer <ynnor@mm.st>
      However, the other reason I didn't see "Useless use of a constant in a void context" is that my colleagues code has a variable (not a constant) after the 'return:'.
      So you would have seen a "Useless use of a variable in void context" warning instead.