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:

  • python replace element in list
  • perl script for factorial of a number
  • python how to encrypt a password in xml
  • python read binary file struct
  • python count number of times a string
  • python get maximum of list
  • sun.net.ftp.ftpclient
  • perl how to set statement attribute
  • python read binary file
  • underline label java

No comments yet.

Leave a Comment