Help for this page

Select Code to Download


  1. or download this
    my $bool = defined &{ 'foo::bar' };
    
  2. or download this
    my $namespace = do { no strict 'refs'; \%{"foo::"} };
    my $bool = exists $namespace->{bar} && defined *{ $namespace->{bar} }{
    +CODE};
    
  3. or download this
    no strict 'refs';
    my $before = exists $foo::{bar}; # false
    my $bool = defined *{ 'foo::bar' }{CODE};
    my $after = exists $foo::{bar}; # true
    
  4. or download this
    undef &{ 'foo::bar' };
    no strict 'refs';
    *{ 'foo::bar' } = sub {};
    
  5. or download this
    no strict 'refs';
    no warnings 'redefine';
    *{ 'foo::bar' } = sub {};
    
  6. or download this
    my $coderef = \&{ 'subroutine_name' }; 
    #undef $$coderef; # typo ?
    undef &{ $coderef };