in reply to How to split unique patterns
Instead of splitting, I would instead match the data I want to keep.
Using a regular expression has the benefit of also somewhat validating your data, so you get notice of malformed input early:
my @columns= qw( name branch code timestamp info1 info2 id); $line=~ /^(A)::(B):(123-456) ([012]\d:[0-6]\d):(C)::(D):(789)/ or die "Malformed input [$line] in line $."; my %info; @info{ @columns }= ($1,$2,$3,$4,$5,$6);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to split unique patterns
by reisinge (Hermit) on Jun 10, 2013 at 14:15 UTC | |
by Corion (Patriarch) on Jun 10, 2013 at 14:35 UTC | |
|
Re^2: How to split unique patterns
by cornelius80 (Initiate) on Jun 10, 2013 at 08:55 UTC | |
by Corion (Patriarch) on Jun 10, 2013 at 09:15 UTC | |
by cornelius80 (Initiate) on Jun 10, 2013 at 09:24 UTC | |
by Corion (Patriarch) on Jun 10, 2013 at 09:37 UTC | |
by cornelius80 (Initiate) on Jun 10, 2013 at 09:59 UTC | |
| |
by AnomalousMonk (Archbishop) on Jun 10, 2013 at 14:08 UTC |