> -----Oprindelig meddelelse----- > Til: [EMAIL PROTECTED] > Emne: OOP <snip> > i create a new book object, $book1; > i have given it no parameters, so it the default will just be > "n/a" for all > three arguments > then i call the getBook method which i return into a variable > i do a print to print the variable > and nothing prints. Hi Jeremy Add a line in your getBook method that reads what object you are dealing with now and then move your my $bookName = $self{bookName}; my $bookAuthor = $self{bookAuthor}; my $bookPublisher = $self{bookPublisher}; section down to the top of your getBook method. Like this: sub getBook { my ($self) = @_; my $bookName = $self{bookName}; my $bookAuthor = $self{bookAuthor}; my $bookPublisher = $self{bookPublisher}; return "$bookName $bookAuthor $bookPublisher\n"; } That ought to do it. Read the documentation (perlboot, perltoot, perltootc, perlobj and perlbot) about OOP in Perl. If you want to know more, read the Camel book and/or Damian Conways book on OOP in Perl. /Henning PS: Remember to use strict - and test with warnings turned on. PPS: The lines explained: my $invocant = shift; This means that you want to know what class or object has been used to access this method. my $class = ref($invocant) || $invocant; If the method was invoked with an object, ref($invocant) returns the object class. Otherwise you just have the class name in $invocant. return bless $self, $class; Bless does exactly that - it blesses a reference. From then on the reference no longer points to a simple datastructure, now it points to an object in the given class ($class). _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users