my $replacement = sub { return unpack("a1", shift); }; #### for (@array) { s/HAI WORLD Times ([0-9]+).*/ '\t\t' /eg; }