in reply to Using regex to match date and time
These are just a few of the reasons why you should be using strict and warnings. These problems must be fixed before you bother with the regex.
It looks like you're trying to read the file one line at a time and do something if it matches. I suggest the following as a general framework:
use strict; use warnings; open DATA, "db.txt" or die $!; my @array; while(<DATA>) { chomp; # save the line in our array push @array, $_; # see if it matches if ($_ =~ /(.*)(\d+:\d+:\d+)(.*?)/g) { # do code } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using regex to match date and time
by Anonymous Monk on Feb 03, 2005 at 20:28 UTC |