On Sun, 28 Feb 2016 08:59:20 +0000
rakesh sharma <rakeshsharm...@hotmail.com> wrote:

> 
> HI all
> 
> I am using object oriented perl and saw return self as well as bless
> being used According to docs bless returns the reference to self. Why
> should we use both statements in the new method
> 
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
> 

Because the variable $self has no special meaning. You could use $this
instead. Or any other name. Or don't use one at all:

sub new {
  my $class = shift @_;

  return bless {}, $class;
}

See
http://perldoc.perl.org/perlobj.html#An-Object-is-Simply-a-Data-Structure


-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to