in reply to Re^3: DBD::Sybase $sth->rows returns -1
in thread DBD::Sybase $sth->rows returns -1

Please remove the COMMIT and give a feedback ;)

Edit
Please change your execute with this one :)
$sth18->execute($userName) or die "Couldn't execute statement: " . $st +h18->errstr;
Execute returns a true value if it succeeds and a false value otherwise, so we abort if for some reason the execution fails.

Another important thing is that Rows method is database-driver specific, so it might not work in other drivers, or it might work differently in other drivers.