<div dir="auto">1. Have code reviews with pass/fail prior to committing code to a release (yes, scripts should be considered software and as such subject to release cycles)<div dir="auto">2. If you cannot, at first glance, understand a regex during this then,</div><div dir="auto">2.1 Save it using a meaningful variable with qr and then use it</div><div dir="auto">2.2 Use the /x modifier and document it ( <a href="https://perldoc.perl.org/perlre#%2Fx-and-%2Fxx">https://perldoc.perl.org/perlre#%2Fx-and-%2Fxx</a> )</div><div dir="auto">3. Store metrics on how long your organization spends per quarter/year on problems like this one and adopt structural practices to reduce/eliminate them. I have found the #1 waster is failing to use a well tested CPAN module that does a better job in lieu of barely tested (and, no surprise, largely undocumented) code that 'promised' to save time.</div><div dir="auto"><br></div><div dir="auto">People are trying to avoid/refactor Perl scripts because they beleive that six months down the road they will inevitably fall into this type of problem. The fact is however there have been several ways to avoid it in the core language available for decades.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 23, 2023, 4:57 PM Richard Reina <<a href="mailto:richard@rushlogistics.com">richard@rushlogistics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
A few years ago I hastily wrote some code that I did not comment very well. In it I found:<br>
<br>
$switch = $. if m!^[0-3]?[0-9]/[0-3]?[0-9]/(?:[0-9]{2})?[0-9]{2}$!; # match date<br>
<br>
Can anyone tell me what $. means?<br>
<br>
Thanks for any help.<br>
<br>
Richard<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org" target="_blank" rel="noreferrer">Chicago-talk@pm.org</a><br>
<a href="https://mail.pm.org/mailman/listinfo/chicago-talk" rel="noreferrer noreferrer" target="_blank">https://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</blockquote></div>