Home: Perl Programming Help: Regular Expressions:
Regular-Expr time

New User

Dec 20, 2011, 6:20 PM

Views: 5929
Regular-Expr time

Hi everyone, I'm working on this example to extract some values from the lines which are provided as input from a text file. However, I'm encountering a strange result.

=====> Inputs
Monday I have an appointment with Alex at 12:40 PM.
we are going to a party on Thursday at 10:30 PM.
=====> Output

====> script
open ($fhandle1, "<", $ARGV[0]) or die $!;
open ($fhandle2, ">", $ARGV[1]) or die $!;
while (<$fhandle1>)
$time=~ m/.*(([0]?[1-9]|[1-1][0-2])(([0-5][0-9])).*/;
print $fhandle2 "Time: $time\n";
close ($fhandle2);
close ($fhandle1);
Any help will be appreciated?


Veteran / Moderator

Dec 20, 2011, 9:21 PM

Views: 5922
Re: [k.alex] Regular-Expr time

Cross posted at: http://forums.devshed.com/perl-programming-6/regular-expressions-872077.html