[perl #117095] state var init getting skipped

Add test case for this bug, which was actually fixed 6 months ago with
ad9e6ae10fb581c6c053b862286f8e187063c3ab.