NB: The  \1 \2 \3 notation is for regex back-references and is not kosher in a  s/// replacement string. warnings would have told you this had you enabled them. This (ab)use of back-references is a special dispensation of Perl, but should be avoided in favor of capture variables; see Variables related to regular expressions in perlvar.

c:\@Work\Perl\monks>perl -wMstrict -le "use strict; use warnings; ;; my $line = 'OD44202,07/01/2015,08/19/2019,08/27/2019,1,07/01/2015,06/ +30/2019,2015-06-20 00:00:00'; ;; $line =~ s/(\d{4})-(\d{2})-(\d{2})\s\d{2}:\d{2}:\d{2}/\2\/\3\/\1/g; print qq{>$line<}; " \2 better written as $2 at -e line 1. \3 better written as $3 at -e line 1. \1 better written as $1 at -e line 1. >OD44202,07/01/2015,08/19/2019,08/27/2019,1,07/01/2015,06/30/2019,06/2 +0/2015<
Also note that you can avoid inflicting LTS upon yourself (and your eyes) by choosing a better regex delimiter:
c:\@Work\Perl\monks>perl -wMstrict -le "use strict; use warnings; ;; my $line = 'OD44202,07/01/2015,08/19/2019,08/27/2019,1,07/01/2015,06/ +30/2019,2015-06-20 00:00:00'; ;; $line =~ s{(\d{4})-(\d{2})-(\d{2})\s\d{2}:\d{2}:\d{2}}{$2/$3/$1}g; print qq{>$line<}; " >OD44202,07/01/2015,08/19/2019,08/27/2019,1,07/01/2015,06/30/2019,06/2 +0/2015<
Please see perlre, perlretut and perlrequick.

Update: Your eyes will also thank you for some whitespace courtesy of the  /x modifier:
    $line =~ s{ (\d{4}) - (\d{2}) - (\d{2}) \s \d{2} : \d{2} : \d{2} }{$2/$3/$1}xg;
And is the  /g modifier really necessary?


Give a man a fish:  <%-{-{-{-<


In reply to Re: New File Not Working by AnomalousMonk
in thread New File Not Working by jalopez453

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.