
k.alex
New User
Dec 20, 2011, 6:20 PM
Post #1 of 2
(2373 views)
|
|
Regular-Expr time
|
Can't Post
|
|
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 2:40 10:30 ====> script #!/usr/bin/perl open ($fhandle1, "<", $ARGV[0]) or die $!; open ($fhandle2, ">", $ARGV[1]) or die $!; while (<$fhandle1>) { $time=$_; $time=~ m/.*(([0]?[1-9]|[1-1][0-2])(([0-5][0-9])).*/; $time="$1"; print $fhandle2 "Time: $time\n"; } close ($fhandle2); close ($fhandle1); ========== Any help will be appreciated? Best
|