in reply to Unexpected output for given program with write function

Generally it helps to whittle your code down to just enough code and data to demonstrate your issue. Of course most of the time when you do that you find the problem yourself, but that really shouldn't prevent you from trying.

I suspect your lines of the form:

write (MY_TOP);

should look like:

$~ = 'MY_TOP'; write;
True laziness is hard work

Replies are listed 'Best First'.
Re^2: Unexpected output for given program with write function
by Tux (Canon) on Jun 10, 2011 at 12:18 UTC

    You can also use it like the first form in a secure way with a twist:

    sub wryte { local $~ = shift; write; } wryte "MY_TOP";

    Enjoy, Have FUN! H.Merijn
Re^2: Unexpected output for given program with write function
by dipesh777 (Novice) on Jun 10, 2011 at 14:40 UTC
    Worked very well. Thanks.