in reply to Re^2: How to divide a line from a text file into 8 digit chunks
in thread How to divide a line from a text file into 8 digit chunks

seems to create a size 11 array with some additional spaces

This is why I added the line with grep after that.

  • Comment on Re^3: How to divide a line from a text file into 8 digit chunks

Replies are listed 'Best First'.
Re^4: How to divide a line from a text file into 8 digit chunks
by AnomalousMonk (Archbishop) on Feb 24, 2009 at 14:41 UTC
    I agree the  unpack solution is better, but a regex solution without the  split complication or  push-ing would be something like:
    >perl -wMstrict -le "my $s = 'GRID 213736 15235.2 -2606.28596.178'; my @ra = $s =~ m{ .{1,8} }xmsg; print qq{:$_:} for @ra; " :GRID : : 213736 : : : :15235.2 : :-2606.28: :596.178:
    Update: Did not notice balakrishnan's earlier and essentially identical reply before posting this.