Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: How to split unique patterns

by Corion (Patriarch)
on Jun 10, 2013 at 09:15 UTC ( [id://1038018]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to split unique patterns
in thread How to split unique patterns

I don't understand the additional requirements from your text. Can you maybe post some (anonymized) more relevant input data?

Replies are listed 'Best First'.
Re^4: How to split unique patterns
by cornelius80 (Initiate) on Jun 10, 2013 at 09:24 UTC
    Hi Corion, Sorry for the misunderstanding. Here goes... I have a string as follows that I will collate into an array: info::gmdate:2013-06-07 05:57:tccat_cico::r From that array, I am intending to split the data based on ':' such that I get the following, info gmdate 2013-06-07 05:57 tccat_cico r However, the "2013-06-07 05:57" gets separated into 2013-06-07 05 57 which is not what is intended.

      Ah - if you want to capture different parts, you need to adjust the parentheses appropriately:

      my $line= q{info::gmdate:2013-06-07 05:57:tccat_cico::r}; my @columns= qw( type tstype timestamp + info1 info2 rest); $line=~ /^(\w+)::(gmdate):(20\d\d-[01]\d-[0123]\d [012]\d:[0-6]\ +d):(\w+):(\w*):(.*)/ or die "Malformed input [$line] in line $."; my %info; @info{ @columns }= ($1,$2,$3,$4,$5,$6);

      Update: Fixed $info{ @columns }= ... to be the correct @info{ @columns }= ...

        Hi Corion, Ohh MMmmyyy,...hmmm,..that really looks nasty,.. Ok,..let me have a look and try to decipher that,.. PS: it could really hasten the process if you could give a little explanation as you dissect each line, please? Kind Regards, Cornelius

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1038018]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found