Aaah ... good catch !!
I thought I had already applied that patch .... and I had applied it to some of my Net-SSH2-0.18 builds, but not the particular Net-SSH2-0.18 I was using at the time :-)
I have now applied it to all of my Net-SSH2 builds, and the OP's script now runs fine. Thanks for pointing this out.