Front page | perl.beginners |
Postings from December 2002
Re: help with classes...
Thread Previous
|
Thread Next
From:
Jenda Krynicky
Date:
December 11, 2002 11:10
Subject:
Re: help with classes...
Message ID:
3DF79B9C.31964.1FF921E0@localhost
From: "Todd W" <trw3@uakron.edu>
> Think about this:
>
> my($frank) = Person->new(); # class method -- $_[0] eq 'Person';
>
> my($jimmy) = Person::new(); # plain 'ol function call -- $_[0] eq '';
Well $_[0] does eq '', but so does $_[78548654].
In this case $_[0] is undef and scalar(@_) == 0.
And if you do
my($jimmy) = Person::new(27);
then $_[0] == 27 versus if you do
my($jimmy) = Person->new(27);
$_[0] eq 'Person' and $_[1] == 27 !
Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
Thread Previous
|
Thread Next