in reply to Re^3: Dera Monks, Have create multiple file from one file now I want to match a pattern in each file at the same time do the replacement with adding one to the match pattern.
in thread Dera Monks, Have create multiple file from one file now I want to match a pattern in each file at the same time do the replacement with adding one to the match pattern.

I'll suggest this instead

my $tp = Time::Piece->strptime($1, DATE_FORMAT); # out the replacement line print "tp is: $tp\n"; # we check $tp values here, just for the record ($tp+ONE_MINUTE*2*$n)->strftime(DATE_FORMAT);

mmmh... this second line needs a var. Try something like this (untested):

$tp = $tp+ONE_MINUTE*2*$n; print "tp is now: $tp\n"; # we check $tp again after the changes $lines[1] =~ 's{:20140924105028(\d+)}'{$tp}e;

I see also a problem here with 's{}'{}e. Delete the "'" --> s{}{}e

  • Comment on Re^4: Dera Monks, Have create multiple file from one file now I want to match a pattern in each file at the same time do the replacement with adding one to the match pattern.
  • Select or Download Code