Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Other people have already posted reasonable solutions so I'll concentrate on the meta-problem here.

You keep posting questions like this, "I have file of format x with data y and I need to sort/count/total/modify it in way z". I think what you really need to do is likely to involve getting a book on SQL and installing a database. All these problems could have been solved in much more effective ways using simple SQL statements.

In this particular instance, what the poor monks responding to your question took 10+ lines to do could be done in one:

select,count(*) from datastore as n1, datastore as n2 where n2 and n2.yearmonth=200207 and n1.yearmonth<200207 group b +y;

Databases really come into their own with tabular data like this and if you're working with it a lot I *highly* recommend getting the necessary books, reading the online tutorials and installing one of the freely available RDBMSs (MySQL, PostGreSQL). That way the only thing you'll have to get perl to do is load the data in, from there you can play to your hearts content.

In reply to Re: Searching Files by PhiRatE
in thread Searching Files by rchou2

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2023-10-01 14:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found