hudo has asked for the wisdom of the Perl Monks concerning the following question:
in a file are records of the following format:
By comparing the id's to the actual processing id (e.g. id=345677 ), I'd like to increase the counter here from 9 to 10 and set the new timestamp. By increasing the counter there is to notice that the new counter-value has 2 digits. The record in the file should look after the processing like this:----0---m---28.07.2007---23:13:18---rest---id=123456 ----9---a---28.07.2007---23:13:46---rest---id=345677 ----0---a---28.07.2007---23:13:57---rest---id=876543
What is the best way to do the whole processing ?---10---a---29.07.2007---13:32:46---rest---id=345677
Here is my code for defining the actual timestamp
### timestamp################################## ( $sec ,$min ,$hour ,$mday ,$mon ,$year ) = localtime; $jahr = 1900+$year; if ( $mon <= 9 ) {$mon = "0"."$mon";} if ( $mday <= 9 ) {$mday = "0"."$mday";} if ( $sec <= 9 ) {$sec = "0"."$sec";} if ( $min <= 9 ) {$min = "0"."$min";} if ( $hour <= 9 ) {$hour = "0"."$hour";} ### end timestamp##################################
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: process record in file
by FunkyMonk (Bishop) on Aug 29, 2007 at 10:36 UTC |