Help for this page

Select Code to Download


  1. or download this
    sub what_does_it_return () return classA | classH {
       return rand(1) > 0.5 
            ? bless( [], 'classA' )
            : bless( {}, 'classH' );
    }
    
  2. or download this
    my classA | classH $x = what_does_it_return();
    
  3. or download this
    $x->something()
    
  4. or download this
    package classA;
    sub something (classA $self) { ... }
    
  5. or download this
    sub what_does_it_return () return classX {
       return rand(1) > 0.5 
            ? bless( [], 'classA' )
            : bless( {}, 'classH' );
    }
    
  6. or download this
    my classX $x = what_does_it_return();
    $x->something() # compile-time blowup, classX doesn't have the "someth
    +ing" method!