in reply to Extracting Line from Text file over 45 days old

You want to take a look at the split function, the DateTime module, and you will probably want to use the following as a way of looping through the file:
open my $fh, '<', $filename or die "Cannot open file '$filename' for reading: $!\n"; while ( my $line = <$fh> ) { # Do stuff here. } close $fh;

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: Extracting Line from Text file over 45 days old
by shmem (Chancellor) on Jan 13, 2008 at 01:26 UTC
    You want to take a look at the split function, the DateTime module
    Seeking a way to tackle the problem, what exactly would be the OP's benefit installing 17 modules?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      That there are 17 modules to be installed is the problem of the cpan script, not the OP. We have computers do repetitive things because they're repetitive.

      I am completely baffled by this "There's too many modules involved!" concern. Do you pay for storage by the kilobyte/hour? I have yet to have a problem and I generally have between 10 and 30 Perl installations on any given machine. All of those will generally take up 2-3G.


      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

        It's not about the disk-weight of the 17 modules. Nor the time and effort required to download and install them. Though for all the good it would do him in solving this particular problem, why not also throw in all of Template::Toolkit while you're at it? And how about throwing in 17 MB (1700+ files in 230+ folders) of BioPerl also. If it is only disk-space, either would be about as useful.

        It is about the intellectual weight of 17 modules. About the 87 KB of html for the top level module documentation that gives one line descriptions and no examples of each of the 90 methods that he doesn't need as well as the 2 he might. And umpteen more pages of FAQs and Tutorials and mailing list archives that he'll need, to work out which are the 2 that he might use; and how to use them; and how to configure his system, post installation, so that he can use them.

        It's about not recommending something like Date::Tiny which if he went the route you suggested would be all he needed. With its seven methods and lightweight POD, it would do everything he would need.

        It's about over-engineered solutions that arise from over-specified problem descriptions based around the two greatest evils in software development today: What-if pessimism and Wouldn't-it-be-nice-if optimism.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.