Help for this page

Select Code to Download


  1. or download this
    # The first one is wrong. It adds a reference to an subroutine named f
    +or the return value of $ship->move (or \&1) 
    # because print returns 1 when it is successful.
    $app->add_move_handler ( \&{$ship->move} ); 
    
    $app->add_move_handler ( sub { $ship->move( @_ ) } );
    
  2. or download this
    #!/usr/bin/env perl
    use strict;
    ...
    
    &$second( 1, 2 );