Today I was tasked with dealing with a new standard file from Pershing. I looked at the layout, wrote a quick regular expression to extract the data (I find unpack confusing and performance is not an issue) and everything broke when I tested it. At first, I thought I had fat-fingered something, but then I realized my numbers had letters and signs in them. After a bit of Google research I found out that I was dealing with signed overpunch fields, a throwback to the punch card days when my parents hadn't even met.
Frustratingly, I couldn't find a good way to fix my numbers. Eventually though, I found Convert::IBM390 and now I am happy camper. This is one of those moments when I'm really glad I work with perl and a shinning reason of why the CPAN is an amazing resource. Thanks Geoffrey!
use Convert::IBM390 qw/unpackeb asc2eb/;
# prints 1000
print unpackeb("z10.4", asc2eb("001000000{"));