in reply to Re^5: Creating 'new' subroutine.
in thread Creating 'new' subroutine.

"@_ is an array, an array in scalar context returns the number of elements (a number), and anumber is never a reference"
that was an answer for that comment, I didnt imply creating a
reference out of a number.
so, I don't understand what is your point.

Replies are listed 'Best First'.
Re^7: Creating 'new' subroutine.
by Anonymous Monk on Oct 11, 2013 at 11:27 UTC

    You posted code where you test an array with ref, it doesn't do what you think it does (it does nothing)

    its the equivalent of  if( not ref "shamalama" eq "dingdong" ){ ... }

    its equivalent to  if(1){ ... }

    clear now?

      thank you, got carried away a bit)

        sub new { my $class = shift; my $self = ref $_[0] ? $_[0] : { @_ }; return bless $self, $class; }

        Grab yourself a copy of the free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too. , it also explains this