my $orig_warn = $SIG{__WARN__}; $SIG{__WARN__} = $orig_warn ? sub { my $w = shift; $orig_warn->($w) if $w !~ /::[ab]" used only once/ } : sub { my $w = shift; warn $w if $w !~ /::[ab]" used only once/ };