in reply to Matching multiple digits
$stamp=~/\d{9,10}/g;
you need to use a while loop to iterate through all the matches like this:
while ($stamp =~ /\d{9,10}/g) { ... }
Besides executing your code for every match, this will also make your code work correctly in the case when there are no timestamps in the input line. This is why you are getting the uninitialized value errors and the spurious '12/31/1969' output. You are using $& in localtime and elsewhere even when the line doesn't contain any timestamps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching multiple digits
by skoney (Novice) on Feb 03, 2008 at 22:15 UTC | |
by halley (Prior) on Feb 03, 2008 at 22:57 UTC | |
by skoney (Novice) on Feb 06, 2008 at 04:19 UTC |