Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: Manipulate class attributes using the ‘set’ and ‘get’ methods

Perl: Manipulate class attributes using the 'set' and 'get' methods
{filelink=14326}

#!/usr/local/bin/perl -w
package person;
use strict;
sub Person {
    my $self = { };
    bless($self);
    $self->{Name} = "";
    $self->{AGE}   = 0;
    return $self;
# return the Name
sub get_Name
{
    my $self = shift;
    return $self->{nom};
}
# set the name
sub set_Name
{
    my $self      = shift;
    $self->{nom} = shift;
}
# return the Name
sub get_Age
{
    my $self = shift;
    return $self->{age};
}
# Modify the age
sub set_Age
{
    my $self      = shift;
    $self->{age} = shift;
}
		}

Users who found this page were searching for:

  • perl how to set statement attribute
  • underline label java
  • python count number of times a string
  • perl add item to hash
  • python replace element in list
  • sun.net.ftp.ftpclient
  • how do i print out the keys of a python dictionary in c++
  • python read binary file struct
  • tkinter python label text an linken rand
  • how to read bufferedimage in java example

No comments yet.

Leave a Comment