Perl formal arguments

Discussion in 'Programming/Scripts' started by, Aug 20, 2009.

  1. New Member

    This is stupid. I've got a module, and I'm calling its functions, passing values to it. I'm doing something like

    my ($val1, $val2, $val3, $val4 ) = (1, 2, 3, 4);
    $obj->func( $val1, $val2, $val3, $val4 );

    However, sometimes it decides to throw some random reference in there.... so my ..._ will look like

    (Module=HASH(0x848f3), 1, 2, 3, 4)

    Why is it just randomly throwing in a reference to a hash in there? It wouldn't be so horrible if it would throw it at the front every time, but when I call the subs from other subs inside the same module, that extra junk doesn't get passed.:(:D:D
  2. parkerlindsey

    parkerlindsey New Member


    When you pass several arrays to a subroutine, Perl creates one list in @_. There is no possibility to determine which elements are from which array. If you need these informations, you can pass references to the arrays. They can then be dereferened by @_.That probably doesn't help but I can't help more unless I see some more code.

Share This Page