in reply to To split with spaces
Another option is to use pipe delimited text as it allows you to visually inspect the data in any text editor. You could then do something like this:
use v5.12; use warnings; use Data::Dump qw(ddx); my @fields = map { ( split /\|/ )[2] } map { chomp; $_ } <DATA>; ddx @fields; # test.pl:5: (0, 0, "", 0, "", 0) __DATA__ 1234|2321|0|45|1st 2122|sdsa|0|0|34 2313|dsad||43|2nd 1232|ffff|0|0|1st 3213|sadf||0|34 2133|dada|0||2nd
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To split with spaces
by thomas895 (Deacon) on Aug 05, 2013 at 01:40 UTC |