my $bits = sprintf "%07b%04b%05b%05b%06b%05b", $year, $month, $day, $hour, $min, $sec; my $fat32 = sprintf "0x%08x", oct( "0b$bits" );