I have the folowing regex verified by regex coach
(\d+)\.(\d+)\.(\d+) (\d+):(\d+):(\d+)
this matches the dd.mm.yyyy hh:mm:ss
format, but in Perl I don't receive anything
My array contains these two entries
foo 24.03.2014 19:18:57 foobar foo bar
bar 24.03.2014 15:19:00 asdfasrwe jlkj
Here is my Perl program
use Try::Tiny;
foreach(@array)
{
try {
my ($day, $month, $year,$hours, $minutes, $seconds) = ($_ =~ m/(\d+)\.(\d+)\.(\d+) (\d+):(\d+):(\d+)/);
my $time= "$hours:$minutes:$seconds";
my $date= "$day.$month.$year";
} catch {
warn "caught error: $_";
};
print "Time: $time, Date: $date\n";
}
The output is
Time: , Date:
Time: , Date:
As with regex coach, my regex is approved, and no exception is shown. I don't see my error. Where is the problem?