in reply to Subroutine's behavior

what am I doing wrong?
You should always use strict and warnings because you would have gotten warnings about your code.