i tried the following example to learn the class .
but it shows the following error.
Can't call method "name" on an undefined value at ClassWithPrg.pl line 17.
plz help me to rectify this error.
Source code
thankyou#!/usr/bin/perl -w sub new() { my $self={}; $self->{FORM_VAR}=undef; bless($self); return $self->{FORM_VAR}; } sub name() { $self->{FORM_VAR}=shift; print "Using the constructor\n\n\n"; return $self->{FORM_VAR}; } + $obj=main->new(); $var=$obj->name("KALAI"); print "Here ::: $var\n";
In reply to Regarding Perl Class Object by editi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |