class Float alias :old_divide :/ def / (other) other == 0 ? nil : old_divide(other) end end #### class MyFloat < Float def MyFloat.new(from) from.to_f() end def / (other) other == 0 ? nil : super(other) end end MyFloat.new(4) / 0 # nil #### use warnings; { no warnings qw/once/; $foo = 5 - $bar; } { no warnings qw/uninitialized/; $foo = 5 - $qux; }