Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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.

by pvaldes (Chaplain)
on Jan 08, 2015 at 13:17 UTC ( [id://1112639]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1112639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-19 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found