unpack is better with fixed-width records
my ( $name, @tests ) = unpack( 'A20 A3 A3 A3 A3', $line );
With 5.8.0+, you can even do
my ( $name, @tests ) = unpack( 'A20 (A3)4', $line );
or
my ( $name, @tests ) = unpack( 'A20 (A3)*', $line );
Update: Heh, I hadn't noticed the bit about unpack at the bottom before posting.
|