Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Retrieve hash between two subroutines in Perl

Expand Messages
  • timothy adigun
    Hi Norah, ... Change the above to: my %hash = @_; # not the first element $_[0] in the special array @_ Since you are passing only the hash to the
    Message 1 of 3 , Apr 5, 2013
    • 0 Attachment
      Hi Norah,

      On Wed, Mar 20, 2013 at 2:17 PM, Norah Jones <nh.jones01@...> wrote:

      > **
      >
      >
      > I would retrieve my hash table when i pass it in argument at a function.
      > In my case, function1 return my hash table, then i pass my hash table in
      > argument to my function2 and in my function2 i would retrieve my hash table
      > for browse it.
      >
      > sub function1{
      > my code;
      > return %hash;
      > }
      >
      > sub function2{
      > #my %hash=$_[0];
      >
      Change the above to:
      my %hash = @_; # not the first element $_[0] in the special array @_

      Since you are passing only the hash to the subroutine.

      > my code browse my hash;
      > }
      >
      > my %hash = function1();
      > function2(%hash);
      >
      > I have the following error : Odd number of elements in hash assignment at
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >



      --
      Tim


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.