in reply to perl pack/unpack optional variable length data

Use length-item/sequence-item, as described in pack.

How are you going to determine whether optional variable string is present in the record?