The debugger is often more sensitive to format of your script than perl itself is. I suspect that you would see the behavior that you expect if you reformat your script with perltidy.
Bill
Comment on Re: If statement seems to ignore elsif and skips to else