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_
$
|