use strict; use warnings; use Data::Dumper; my @linesData; while ( ) { chomp; my @flds = split m{\s+}, $_, 9; my $rest = pop @flds; push @flds, reverse map { $_ = reverse } split m{\s+}, reverse($rest), 10; push @linesData, \@flds; } print Data::Dumper->Dumpxs([\@linesData], [qw{*linesData}]); __END__ Mon Oct 1 17:09:23 2001 0 127.0.0.1 2611 1774034 a _ o r tmbranno ftp 0 * c Mon Oct 1 17:09:27 2001 0 127.0.0.1 22 1774034 a _ o r tmbranno ftp 0 * c Mon Oct 1 17:09:27 2001 0 127.0.0.1 22 file with spaces in it.zip a _ o r tmbranno ftp 0 * c Mon Oct 1 17:09:31 2001 0 127.0.0.1 7276 p1774034_11i_zhs.zip a _ o r tmbranno ftp 0 * c #### @linesData = ( [ 'Mon', 'Oct', '1', '17:09:23', '2001', '0', '127.0.0.1', '2611', '1774034', 'a', '_', 'o', 'r', 'tmbranno', 'ftp', '0', '*', 'c' ], [ 'Mon', 'Oct', '1', '17:09:27', '2001', '0', '127.0.0.1', '22', '1774034', 'a', '_', 'o', 'r', 'tmbranno', 'ftp', '0', '*', 'c' ], [ 'Mon', 'Oct', '1', '17:09:27', '2001', '0', '127.0.0.1', '22', 'file with spaces in it.zip', 'a', '_', 'o', 'r', 'tmbranno', 'ftp', '0', '*', 'c' ], [ 'Mon', 'Oct', '1', '17:09:31', '2001', '0', '127.0.0.1', '7276', 'p1774034_11i_zhs.zip', 'a', '_', 'o', 'r', 'tmbranno', 'ftp', '0', '*', 'c' ] );