#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $rcount = 1; while () { my $string = $_; next if $rcount++ < 8; my @fields = unpack ('A34 A30 A40', $string); print Dumper(@fields), "\n"; } __DATA__ Ignore Me Line 1 Ignore Me Line 2 Ignore Me Line 3 Ignore Me Line 4 Ignore Me Line 5 Ignore Me Line 6 Ignore Me Line 7 This is a very long sentence which should illustrate the unpacking functionality in accordance to what you require.