>>>>> "sw" == shawn wilson <ag4ve...@gmail.com> writes:

  sw> I dig what you're saying about always using return. However I
  sw> don't (have never used / seen) a case where a sub returns last
  sw> expression. An example maybe?

the classic case which is used in the constant pragma is:

        sub FOO() { 'foo' }

the last (and only) expression is returned. the () make it a prototype
with no args so it will reduce to the constant value at compile time.

it is mostly when you see stuff like this:

sub foo {

        # code here 

        $stuff ;
}

$stuff is returned if it falls through to the that line. simple.

as i said don't do that unless it is a special case. use explicit return
statements.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to