#!/usr/bin/perl use warnings; use strict; sub mixedregex { s[\\0([0-7]{3})][chr oct $1]egr; } $_ = '\0123'; print mixedregex(); # S