Save packed data to a file
$time = time;
$s = pack ("a8a8L", Mike, Flash, $time);
open FILEHANDLE, ">file.dat" or die "Can not open file.dat";
print FILEHANDLE $s;
close FILEHANDLE;
open FILEHANDLE2, "<file.dat" or die "Can not open file.dat";
$s2 = <FILEHANDLE2>;
close FILEHANDLE2;
($first, $last, $time) = unpack ("a8a8L", $s2);
print "First name: $first\n";
print "Last name: $last\n";
print "Time: ", scalar localtime($time);
Related examples in the same category