Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool How do you display all the hash values in perl?

    %HASH JUST DISPLAYS ALL OF THE KEYS, ALONG WITH THE VALUES.

    (keys %HASH) JUST DISPLAYS THE KEYS.

    I TRIED SOME OTHER STUFF, LIKE @HASH AND %HASH{*} BUT THAT DIDN'T WORK. I DON'T WANT THE KEYS, JUST THE REAL VALUES.

    I CAN'T FIGURE OUT HOW TO DO THIS. CAN A PERL EXPERT PLEASE HELP ME?



    ___________________
    I believe that if anything is worth doing, it would have been done already

  • #2
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb

    Hi seocode,
    I am no expert, but I made that for one of my codes:

    foreach $i ( keys %hash ) {
    print $i;
    }

    As you can see, you dont need to know the keys to get
    the values with that piece of code.

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by mrdvd030 View Post
    Hi seocode,
    I am no expert, but I made that for one of my codes:

    foreach $i ( keys %hash ) {
    print $i;
    }

    As you can see, you dont need to know the keys to get
    the values with that piece of code.
    or maybe you used values not keys.

    Code:
    foreach my $val (values %hash){
         print $val;
    }
    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •