I have seen many ways to measure someone’s Perl skills. Most of these ways are based on usage of certain Perl concepts. Today I have stepped on the next level according to some skill measurements. I have used the
unpack function very naturally, and without much hussle. Here is the snippet:
#!/usr/bin/perl -w use strict; my ($year, $month, $date, $hour, $min, $sec) = unpack("a4a2a2a2a2a2", 20040102200534); print "$date/$month/$year $hour:$min:$sec";
I could have done it before surely, but today it came to me naturally – without any thinking or manual reference. I will have to expand and polish this skill now.
unpack are very powerful functions and can simplify life a lot. It’s time I start using them.