---------- Forwarded message ---------- From: Tech tech417 <[EMAIL PROTECTED]> Date: Aug 24, 2005 3:09 PM Subject: Re: how to run perl class? To: Xavier Noria <[EMAIL PROTECTED]>
Hi, Create Person.pm with following contents: package Person; sub new { my($type) = $_[0]; my($self) = {}; $self->{'name'} = $_[1]; bless($self, $type); return($self); } sub tellname { my($self)=$_[0]; print "Person name is $self->{'name'}.\n"; } 1; and calling script test.pl is: use Person; $obj = Person->new('Prabahar'); $obj->tellname(); Now run the test.pl script. # perl test.pl Person name is Prabahar. Thanks. On 8/24/05, Xavier Noria <[EMAIL PROTECTED]> wrote: > > On Aug 24, 2005, at 9:39, praba har wrote: > > > Dear All, > > > > I try to run a sampleclass example program > > in perl. But I received error. How to avoid it? > > The code is below: > > > > Package Person; > > Perl is case-sensitive: "package". > > > Can't locate Person.pm in @INC (@INC contains: > > /Users/enmail/perl > > Does /Users/enmail/perl/Person.pm exist? > > -- fxn > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>