#!/usr/bin/perl use strict; use warnings; use 5.010; my %par = ( text => "Tes\x01t", zeichen => qr{ [e \x01] }x, ); test(\%par); say $par{text}; sub test { my ($par) = @_; $par->{text} =~ s/$par->{zeichen}//g; }