#!/usr/bin/env perl -l use strict; use warnings; my $text = " \u003cdiv class=\"ja-job-details\"\u003e \u003ch2 " . "class=\"title\"\u003eGlobal Service ..."; print "TEXT: $text"; (my $html = $text) =~ s/(00[3-7][0-9a-f])/pack 'H4', $1/eg; print "HTML: $html";