# Multiline and ignores whitespace ($mystring = <<'__EOI__') =~ s/([0-9a-fA-F]{2})/chr($1)/g; 0D 0A ... 0D 0A ... 0D 0A ... ... __EOI__