Just another Perl shrine | |
PerlMonks |
[OneLiner] What am I doing wrong in my regex?by three18ti (Monk) |
on Jul 18, 2014 at 19:57 UTC ( [id://1094262]=perlquestion: print w/replies, xml ) | Need Help?? |
three18ti has asked for the wisdom of the Perl Monks concerning the following question: Hello Monks
I had to bump the version in a number of files; as it was too many to do by hand I thought I could handle it in a oneliner. Spoiler alert: I did get it worked out with a oneliner (at the end), but I'm flummoxed to no end as to why my first attempt was not working. Can anyone give me any clues to what I was doing wrong? Here are my wrong initial attempts (and their output), the first one is probably the most puzzling, if $version is undef, where did "version '1.2.36'" come from?!?:
Now of course, doing this in a script works:
Epilogue: I did get it figured out, first of all, I only needed to change the last decimal point, so really I only needed to capture the last decimal point. I'm at a loss as to why this one works and my version was unable to match... (but I solved my problem so the issue is at least out of the way) (credit goes to my coworker)
I appreciate any insight that may help me avoid obvious mistakes in the future (although I've driven myself up a wall trying to find any "obvious" mistakes...) Thanks!
Back to
Seekers of Perl Wisdom
|
|