http://www.perlmonks.org?node_id=1037969


in reply to passing return value of a function to print

As an alternative to farang's (++) method: Declare the sub first, then you don't need the parens:
perl -e ' sub f {"123\n"}; print f' # prints '123'
You could also pre-declare a stub, use it, then add the code for the sub:
perl -e 'sub f;print f; sub f {"123\n"}'

             "The trouble with the Internet is that it's replacing masturbation as a leisure activity."
        -- Patrick Murray