http://www.perlmonks.org?node_id=217850


in reply to File parse

This is a perfect job for unpack. The following test code should prove helpful:

use strict; while (<DATA>) { chomp; my @array = unpack("A12A16A11A*", $_); # @array has 4 elements now print map("'$_'\n", @array); } __DATA__ 0x130005d 1.253.54.1_MIB 0x230f0 SNMP 0x130009c 0x1006b SnmpPif
"One word of warning: if you meet a bunch of Perl programmers on the bus or something, don't look them in the eye. They've been known to try to convert the young into Perl monks." - Frank Willison