Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  
Server Error (Error ID 289328b63174)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

on Apr 20, 2000 at 23:26 UTC ( #8251=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        package Person;
        use strict;
    ...
                NAME => undef,
                AGE  => undef
            };
    
  2. or download this
            my $closure = sub {
                my $field = shift;
                @_ and $self->{$field} = shift;
                $self->{$field};
            };
    
  3. or download this
            bless $closure, $class;
            $closure;
        }
    
  4. or download this
        sub name { &{ $_[0] }("NAME", @_[1 .. $#_ ] ) }
        sub age  { &{ $_[0] }("AGE",  @_[1 .. $#_ ] ) }
    
  5. or download this
        use strict;
        use Person;
    ...
        $person->age(22);
    
        print $person->name, " is ", $person->age, " years old.\n";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://8251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2016-09-27 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (511 votes). Check out past polls.