# #1137654 my $find = "20150518<"; # assumes that a date-like value not +followed by a '<' is not what you seek my $replace = "18 May 2015"; while(my $line = <DATA>) { if($line =~ $find) { # select lines to print, unless you want + all lines * Note1 s/$find/$replace/g; # UPDATE: but the slash-g is utterly unne +cessary print $line; # as it would act only on single line +s in this case } } # * Note1: acknowledged: you want all lines. (another update) =head output 20150518<114319747011000001>, 20150518<bulkbull3>, =cut __DATA__ 20150518<114319747011000001>, 20150518230002,< >, 917696706652,01, , 52727, rch,, admin,, 01,21314,, bulkpull2,, 20150518<bulkbull3>,

check Ln42!


In reply to Re: using s///g; by ww
in thread using s///g; by ravi45722

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.