Help for this page

Select Code to Download


  1. or download this
    my $x = 42;
    assert '$x > 40';   # assertion fails,
                        # because eval can't see $x
    
  2. or download this
    sub assert (&) {
       require Carp;
    ...
    
    my $x = 42;
    assert { $x > 40 };   # assertion ok
    
  3. or download this
    sub TRUE         () { 1 }
    sub FALSE        () { 0 }
    sub EXIT_SUCCESS () { TRUE }