Kenneth - Thanks for response. I doubt that it is issue with split. I have another simple codes which works well.
#!/usr/bin/perl -w use strict; use Time::Local; my $filename = "/tmp/IN/m1.xml"; my $finaltime = &UTCtoLocal($filename); print "$finaltime \n"; sub UTCtoLocal { my ($filetoread) = @_; open (INFILE, "<$filetoread") or die "$!"; my @ActTime = map {/"(.*?)"/} grep {/MessageDateTime/} (<INFILE>); my $iso_time = join("", @ActTime); my $expected_epoch = 1 * 60 * 60 + 1 * 60 + 1; my ($date, $time) = split /T/ => $iso_time; my ($year, $mon, $mday) = split /-/ => $date; $year -= 1900; $mon -= 1; my ($hour, $min, $sec) = split /:/ => $time; my $nsec = chop($sec); my $mtime = timegm($sec, $min, $hour, $mday, $mon, $year); return ($mtime); }
Based on these codes i prepared another one in OP as that is my main objective.
reagarding the inputfile, i have already provided the line which has this date and keyword used in the grep command.
any further clue?
In reply to Re^2: Month '-1' out of range 0..11
by swissknife
in thread Month '-1' out of range 0..11
by swissknife
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |