Help for this page

Select Code to Download


  1. or download this
         Sometimes you want to call a method when you don't know the
         method name ahead of time.  You can use the arrow form,
    ...
             if ($coderef = $fred->can($parent . "::findbest")) {
                 $self->$coderef(@args);     # call by coderef
             }
    
  2. or download this
    $obj->method(1, 2, 3);         # general case
    
    ...
    if ($sub = $obj->can('method')) {
        $sub->($obj, 1, 2, 3);     # same effect as general case
    }