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


in reply to Subroutine Produces Output but Fails to Return to Parent

The code you provided works for me after I add a line to print the result, so your problem is elsewhere.

You should always use both strict and warnings, as they will catch many common errors. In your example code you used mixed case in your variable names, which would be an easy place to introduce a typo.

After adding strict and warnings you should reduce the code to the simplest form that still behaves incorrectly. Chances are you will find the error by doing this, and if not we will be happy to assist you further. But please confirm that the reduced version still demonstrates the error (and that it runs of course).

  • Comment on Re: Subroutine Produces Output but Fails to Return to Parent