very basic perl question

RichieZ

Diamond Member
Jun 1, 2000
6,549
37
91
Let me begin by saying I have never programmed in Perl before, so forgive me if I use incorrect terminology

So lets say I have a function defined in a perl module:
##
# Selector for title.
#
sub title {
my ($this) = @_;

return $this->{TITLE};
}

So in my Perl script(?) I tell it to use the module (ie: use Document;)

when I try and call the function i get the following error:
Can't call method "title" on unblessed reference at ~\indexer.pl line 72.

heres the snippet of code I wrote that causes this error:
sub test{
my (@docs) = @_;

my $newdoc = $docs[0];
my $newtitle = $newdoc->title();
print->title();
}

I'm a perl newbie and I can't figure out why this would cause an error, the way i wrote this was exactly like an example that was give to me