use strict; use warnings; my $str = "junk not junk"; { no warnings qw/void/; $str !~ s/junk//g; }