I've tried running the SQL separately and unfortunately it always runs to completion, giving me the expected result.
In my original post I've only posted a small fragment of a much larger code which executes many similar SQL statements within a very short time (like within 1 minute). The code is in fact used in a Datastage parallel job which spawns at least 4 instances of my Perl code in parallel. The code always gets stuck for the same SQL rather than for random (similar) SQLs.
I'm also consulting Sybase DBAs to see if there is a limitation on the number of active connections at any time (which may be a setting specific to my database, set by the DBA or may be a Sybase IQ 15.4 default behavior).
Since DBD::Sybase works fine with Sybase IQ, I'm inclined to believe that the problem may be related to the database rather than the code itself.
Since Sybase 15.4 is a pretty recent iteration of the IQ product, perhaps some default behavior may have changed, I'm really not sure at the moment.