Help for this page

Select Code to Download


  1. or download this
    my $coderef = sub {shift;};
    my $val=$coderef->("Hello from down under");
    ...
           }
    
    &doit($val);
    
  2. or download this
    my $coderef = sub {shift;};
    sub doit{
           print shift, $/;
           }
    &doit($coderef->("Hello from down under"));
    
  3. or download this
    #Closured.pm
    #!/usr/local/bin/perl        -cw
    ...
        &{$_[0]};
        }
    1;
    
  4. or download this
    #using the Closured class...
    use strict;
    ...
    my $object = Closured->new("Hisham"); #try to feed a constructor direc
    +tly.
    print $object,$/;   #the constructor retruns a code ref.
    print $object->name("BioHisham"), "\n";  #Feed via an instance method
    
  5. or download this
    #Output 
    Closured=CODE(0x18449ac)
    BioHisham
    
  6. or download this