in reply to list values of specific hash keys

You could write that as:
push @value_table, @hash{@keys};
But there isn't anything obviously wrong with your code. And you aren't saying how you came to the conclusion your code doesn't work.

Replies are listed 'Best First'.
Re^2: list values of specific hash keys
by sorenjul (Initiate) on Feb 27, 2012 at 21:10 UTC
    Hi Thanks for the answer. When I run my script i get an error: Use of uninitialized value @hash[0] in print. Same error with your piece of code. I'm trying to print the value to test if I'm on track. \Sorenjul

      @hash[0] is a single-element array slice. You'll probably have to post more code, but that looks wrong to me.


      Improve your skills with Modern Perl: the free book.

      You don't have a print statement in the snippet you post.

      Please, to avoid having people to guess what's wrong with your code, post the right code, the error message you are getting, and anything else that's necessary to reproduce your problem.

      Really, if your error is at a print statement, and neither your code snippet nor your description mentions this, you're just wasting everyones time.

        Hi

        Sorry for not being clear about the print, but the issue was that I could not generate the combined string and the way I tested it was with print. I think I solve part of the problem by chomp'ing $key before using it and declaring all variables outside the loop.

        \Sorenjul