#!/usr/bin/perl use warnings; use strict; #use kopfschmerzen; my $string = '----9---a---28.07.2007---23:13:46---rest---id=345677'; my $regexp = '----(\d+)---\w+---(\d+.\d+.\d+)---(\d+:\d+:\d+)---rest---id=(\d+)'; my ($count, $date, $time, $id); $string =~ /$regexp/i; $count = $1; $date = $2; $time = $3; $id = $4; if( $id == 345677 ) { $count += 1; $date = localtime(); $time = localtime(); print "----$count---a---$date---$time---rest---id=$id"; }