in reply to Re: Re: Re: Just a regex quickie
in thread Just a regex quickie

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Just a regex quickie
by dragonchild (Archbishop) on Jun 02, 2004 at 15:53 UTC
    A few thoughts, in no particular order:
    • By breaking the problem down into smaller parts, you don't have to think as much about stuff that doesn't matter. For example, I missed the pipes when reading your regex because I was trying to figure out what the heck it was supposed to match.
    • My initial response may have been a little acerbic, but it's also free. And, the OP did look like it was a frustration post. While that's fine, I'm going to treat you as I would treat my coworkers - gently point them in the right direction. You're not going to learn how to solve these kinds of issues on your own if I tell you the answer.
    • Part of your issue is that you're not using the best tool for the job. You have a bunch of pipe-delimited strings in an array. Why don't you have it as an array of arrays? Even better, why not an array of hashes? Then, your sorting becomes a simple matter of picking which element you want to sort on.@lines = sort { $b->{year} <=> $a->{year} } @lines; Very simple, error-proof, and self-documenting. Not to mention, it's more efficient in terms of both memory and CPU. All benefits and no drawbacks (except in pathological cases).
    • Posting online has a very big drawback - we cannot see each other. Most human communication is based on body language, tone modulation, and other, non-literate cues. We don't have any of those cues online. However, it is more than likely that a post on Perlmonks (and similar sites) is not going to be intentially rude, especially the first response to a question. What the medium lacks in non-literate cues, the site attempts to make up in expected behavior.

      In other words, if you feel offended, read it again. You're probably misreading something.
    • Posting online has a very big benefit - you can stop and think before you hit the Create button. While the chocolate teapot phrase is actually quite neat, I don't think it was the most ... encouraging thing to say to someone who is attempting to help you
      • for free
      • without knowing you
      • without knowing what you're trying to do
      • without knowing your skill level
      • without knowing your deadline(s)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

    A reply falls below the community's threshold of quality. You may see it by logging in.