Ah, you're using an ancient perl. Simply leave out the use feature qw/say/; line, and replace say; in the loop body with a print statement:

while(<DATA>) { chomp; s/<([0-9A-F]+)>/hex($1)/eg; print "$_\n"; }

Actually, you could probably also get away with not chomping your input in the first place here:

while(<DATA>) { s/<([0-9A-F]+)>/hex($1)/eg; print; }

And at this point, assuming you merely want to output the results and do nothing further with them in this particular script, the whole script can be turned into a oneliner you can directly enter on the command line. Using perl's -p switch (see perlrun):

$ perl -pe 's/<([0-9A-F]+)>/hex($1)/eg' /home/stummala/a JDW-HP 1MVWV93V7j2Hxsa0Ag6 24:00:00 SUBJECT_EXACT _Did you160serve our +160country? -New VA Home.Loan Program_ JDW-HP 1MVWV98Ddd4fLsa0Ag6 24:00:00 SUBJECT_EXACT Did.you.serve_our co +untry? New-VA Home160Loan Program_ $

In reply to Re^5: How do i replace one variable with another after searching for a pattern by AppleFritter
in thread How do i replace one variable with another after searching for a pattern by Niklaus Mikaelson

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.