![]() |
|
There's more than one way to do things | |
PerlMonks |
Strange Occurrence in Substitution Statementby roho (Bishop) |
on May 06, 2025 at 18:50 UTC ( [id://11164964]=perlquestion: print w/replies, xml ) | Need Help?? |
roho has asked for the wisdom of the Perl Monks concerning the following question:
I have paired the problem down as much as possible. In the SSCCE below I am removing placeholder backticks between date and time (the reason for this lies in complete program). I am also removing extra spaces in the text (again, the reason for this lies in the complete program). When there is no extra space to remove the "$extra" variable contains the empty string, which I explicitly set to the empty string to recreate the error condition in the SSCCE.
The problem is the second and subsequent lines have the backtick removed (i.e., replaced with nothing), while the first line is processed as expected where the backtick is replaced by a single space. It appears the substitution of "$extra" is taking out the backticks (for data lines 2 and following) before the following substitution replaces backticks with a single space. It's a mystery why only the first data line is processed correctly.
"It's not how hard you work, it's how much you get done."
Back to
Seekers of Perl Wisdom
|
|