Vaish has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
My code is not getting executed when it reaches the following statements. Can anyone please explain me what actually these code represent ?

subr
{
# This printimage returns the following 3 values
#username: qwe$err
#password: vva**1
#statements:
#

$::sql->printImage () if $::opt_debug;
@::output = $::sql->hash ($_[0]);
}
can you please explain me what does this sql->hash will try to do ?
Thanks in Advance
Vaish
  • Comment on what is the meaning for $::sql->hash ($_[0]); ?

Replies are listed 'Best First'.
Re: what is the meaning for $::sql->hash ($_[0]); ?
by Fletch (Bishop) on Jul 03, 2008 at 12:43 UTC

    It's calling the method hash on the variable $sql in the main package passing the first argument the sub was given. $Foo::bar means to access the scalar variable $bar in the symbol table of package Foo; if the package name is omitted it's the same as if you'd specified $main (so your example is really just $main::sql->hash( $_[0] )).

    This is all covered in perlmod in the first few paragraphs (well the :: and package symbol table stuff is at least).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Thanks Fletch. I will go through the perlmod
Re: what is the meaning for $::sql->hash ($_[0]); ?
by oko1 (Deacon) on Jul 03, 2008 at 14:29 UTC

    Your code will not run because there's no Perl function called 'subr'.

    Please don't post "fake" code without denoting that you're doing so.

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells
    
      Okol, That is not a fake code. It should have happened when I copied my code there . It should be sub r1 which meant as first subroutine. The main reason for posting the code was that I didn't understand the meaning what and how the sql->hash function will work and store in output variable.