$lastlog_t = "L a32 a256"; #(your machine maybe differ); $LEN = length(pack($lastlog_t,0, '', '')); print "length = $LEN \n";