sub display { my ($self) = @_; if ($self) { my $text = " Student Name: $self->{NAME}\n"; $text .= " Age (yr): $self->{AGE}\n"; $text .= " Regd no: $self->{REGD_NO}\n"; return $text; } else { return "Not found"; } }