Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: I would like to find a good logic to parse the data

by naikonta (Curate)
on May 25, 2007 at 13:32 UTC ( #617488=note: print w/ replies, xml ) Need Help??


in reply to I would like to find a good logic to parse the data

I appreciate your intent to roll your on, but I instead suggest to use Text::ParseWords, it's part of Perl standard distribution. You can learn the logic from there, or from other module suggested by other monks in this thread.

#!/usr/bin/perl use strict; use warnings; use Text::ParseWords; while (<DATA>) { chomp; my @parts = parse_line(',', 0, $_); print join(' ', map { "[$_]" } @parts), "\n"; } __DATA__ Submitted,"696,028","50,946","810,590","836,505","13,923,241","13,776, +443","14,179,619","14,614,558","14,704,885","14,634,911","15,055,774" +,"15,127,534","14,458,899","14,403,378","14,566,425","14,644,406","14 +,524,069" Expired,245,275,273,248,240,295,353,316,371,398,387,352,310,288,405,27 +4,270 Less in,90.12%,90.49%,90.04%,89.55%,90.09%,90.63%,90.37%,90.48%,90.73% +,90.59%,90.83%,90.40%,88.82%,90.71%,90.72%,90.69%,91.04%
Output:
[Submitted] [696,028] [50,946] [810,590] [836,505] [13,923,241] [13,77 +6,443] [14,179,619] [14,614,558] [14,704,885] [14,634,911] [15,055,77 +4] [15,127,534] [14,458,899] [14,403,378] [14,566,425] [14,644,406] [ +14,524,069] [Expired] [245] [275] [273] [248] [240] [295] [353] [316] [371] [398] +[387] [352] [310] [288] [405] [274] [270] [Less in] [90.12%] [90.49%] [90.04%] [89.55%] [90.09%] [90.63%] [90.37 +%] [90.48%] [90.73%] [90.59%] [90.83%] [90.40%] [88.82%] [90.71%] [90 +.72%] [90.69%] [91.04%]

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


Comment on Re: I would like to find a good logic to parse the data
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-09-19 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (132 votes), past polls