in reply to Pack + Fat32 timestamp

Take a look at that stack overflow reply that shows how the bitmask is constructed. This bitmask breakdown should be almost a blueprint to your code. I also tend to struggle with pack so using the left shift operator for each group of bits:
my ($sec, $min, $hr, $day, $mth, $yr) = localtime($info[10]); $mth++; $yr -= 80; # change offset from 1900 to 1980 { use integer; $sec /= 2; } # convert sec units from 1 to 2 my $packed = ($year << 25) + ($mth << 22) + ($day << 16) + ($hr << 11) + ($min << 5) + $sec;

One world, one people