in reply to annoying HASH (0xsomething)

When you call a sub as a method, such as $obj->passwd(...), the first parameter being passed to the method is a (blessed) reference to the object instance (often assigned to a variable $self within the method). This is what stringifies as My::Module = HASH(0x2ab7df04ba50) in your case.

$rela->passwd($pass_clear); # passes two arguments: objref, pass +_clear My::Module::passwd($pass_clear); # passes one argument: pass_clear

You should decide whether you want a method or a regular subroutine.  A method makes sense, if you need access to the object's instance data within the method — which doesn't seem to be the case with your passwd routine.

Replies are listed 'Best First'.
Re^2: annoying HASH (0xsomething)
by kosta (Sexton) on Jan 18, 2011 at 14:39 UTC
    Thank you very much dude!
    I am so much used to Java for OOP and Perl for just straight scripting. It is terrible when I try to mix my knowledge of both :D I solved my problem by adjusting the line with getting the parameter (just passed number 1 instead of 0)
    sub passwd{ >>$pass_cleartext=$_[1]; }

    thanks again and have a good one

      This will now fail if you call it as a subroutine. :) Try this instead:

      sub passwd { my $ppr = Authen::Passphrase::MD5Crypt->new( salt_random => 1, passphrase => pop); return $ppr->as_crypt; }

      Now it will work no matter which way you invoke it.

      -- 
      Education is not the filling of a pail, but the lighting of a fire.
       -- W. B. Yeats