perl: fixed handle error codes from packet header