Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: In my perl script one of the variable it is giving an extra dot.by kcott (Archbishop) |
on May 25, 2022 at 14:37 UTC ( [id://11144185]=note: print w/replies, xml ) | Need Help?? |
Firstly, I agree with others that it would be preferable to deal with the problem at the source, rather than fixing it within your code. It's entirely possible that you'll need to repeat exactly the same fix in multiple scripts, modules or subroutines. If that's not possible, it may be insufficient to just add a ^ anchor and remove the g option. What about hidden files (e.g. .bashrc) or places where intentionally specifying the current directory is necessary. You may need something closer to
Consider this SSCCE:
Output:
That's just an example. Modify the test cases to better reflect your real data. — Ken
In Section
Seekers of Perl Wisdom
|
|