You mean like this?  I'm not 100% sure what you're asking.

##########################################

use strict;
use warnings;

open(INFILE,"<myfile.txt") || die "Couldn't open 'myfile.txt' for
reading!\n";

my @LinesIWantToKeep;

while(<INFILE>){
   if($_ =~ /Jan 12/){
        push @LinesIWantToKeep,$_;
        my $line = <INFILE>;
        push @LinesIWantToKeep,$line;   
   }else{
        <INFILE>;
   }
}

print @LinesIWantToKeep;

###########################################


-----Original Message-----
From: Harold Castro [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 3:55 PM
To: beginners@perl.org
Subject: Is there a regexp that will match two or more expressions???

Hi,

I'm looking for a regexp that will match two
expressions. Each line of the file I'm reading
contains different months and years. I'm only after
those lines with particular year and month. All those
lines with january and 2005 for example. Any idea?
Thanks!
here's a portion of the file.

Wed Jan 12 03:50:18 PHT 2005    Wed Jan 12 04:00:17
PHT 2005    0.17 hours              2693
Sun Jan  9 10:00:10 PHT 2005    Sun Jan  9 14:00:11
PHT 2005    4.00 hours              2636
Fri Jan  7 09:40:14 PHT 2005    Fri Jan  7 09:50:14
PHT 2005    0.17 hours              2576
Sat Jan 31 19:18:53 PHT 2004    Tue Feb  3 10:24:54
PHT 2004    2.63 days               106689
Sat Jan 31 13:25:15 PHT 2004    Sat Jan 31 13:52:51
PHT 2004    0.46 hours              106678
Sat Jan 31 10:46:09 PHT 2004    Sat Jan 31 12:48:11
PHT 2004    2.03 hours              106671




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to