in reply to Comparing Dates and Reoccurance - Part III

Second NetWallah's comment re paid consulting (despite the contrarian act of providing of a solution).

Compare the split at line 19 of the previous with what you've done (again!).

And, to gild the lily, here's a variant on what the previous answer provided, done in a very cumbersome manner, in the hope it offers some additional insight into how the regex in split (and regexen generally) actually work:

my $data ="2008-Jan-01 00:00:00 UTC (GMT +0000) - Toll: channel = seve +n, ref = xxx.xxxxxx.xxx.xxxxx.xxxxxxx, tids = 123456789"; print "\n---->Variation 1 (Cumbersome coding to be explicit)\n\n"; # split just once, on " - " (space hyphen space) for the data given my ($datetime, $therest) = split /\s-\s/, $data; my ($toss1away,$channel,$therest2) = split /=\s(.*?),(.*)/, $therest; # capture anything between "= " and the next comma my ($toss2away,$ref,$tids_uncleaned) = split /=\s(.*?),/, $therest2; my ($toss3away,$tids) = split /=\s(.*)/, $tids_uncleaned; print "DT: " . $datetime . "\nChannel: " . $channel . "\nref: " . $ref + . "\ntids: " . $tids . "\n"; print "\n---->Variation 2 (Merely splits the data withOUT removing unn +eeded descriptors)\n\n"; my ($datetime,$channel,$ref,$tids) = split /\s-\s|,\s/, $data; # spl +it on , print "DT: " . $datetime . "\nChannel: " . $channel . "\nref: " . $ref + . "\ntids: " . $tids . "\n"; print "\n---->Variation 3 (Provides a header, removes descriptors from + data.\n\tCould easily be revised to push each set of multi-line data + to an AoA.)\n\n"; my $header=<<HEADER; DATETIME\t\t\t\tChannel\tRef\t\t\t\ttids ====================================================================== +======================== HEADER print $header; # now, get rid of "Toll: channel = " (so output is just "seven"), etc my ($throwaway,$cleanchannel) = split /\s=\s(.*)/, $channel; ($throwaway,my $cleanref) = split /\s=\s(.*)/, $ref; ($throwaway,my $cleantids) = split /\s=\s(.*)/, $tids; print "$datetime\t$cleanchannel\t$cleanref\t$cleantids\n";

OUTPUT

perl 675658-2.pl ---->Variation 1 (Cumbersome coding to be explicit) DT: 2008-Jan-01 00:00:00 UTC (GMT +0000) Channel: seven ref: xxx.xxxxxx.xxx.xxxxx.xxxxxxx tids: 123456789 ---->Variation 2 (Merely splits the data withOUT removing unneeded des +criptors) DT: 2008-Jan-01 00:00:00 UTC (GMT +0000) Channel: Toll: channel = seven ref: ref = xxx.xxxxxx.xxx.xxxxx.xxxxxxx tids: tids = 123456789 ---->Variation 3 (Provides a header, removes descriptors from data. Could easily be revised to push each item to an AoA for further proces +sing, already explained elsewhere.) DATETIME Channel Ref + tids ====================================================================== +======================== 2008-Jan-01 00:00:00 UTC (GMT +0000) seven xxx.xxxxxx.xxx.xxxxx.x +xxxxxx 123456789

You'll probably get better help on future questions if you keep in mind that we're not collecting part of the payment you receive from (whatever) toll road agency.