CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [Laurent_R] "exists" if you just have hash reference?: Edit Log


Jun 19, 2013, 10:51 AM

Views: 2828
Re: [Laurent_R] "exists" if you just have hash reference?

Sorry I think I asked the question wrong. I understand that my %hashRef = stupid_sub() is incorrect. I was just saying, if I write that line of code, perl says it compiles correctly, so my assumption is that the reason I'm getting the original error is because it won't let me use exists on a reference to a hash.

I was wondering how I could condense the following code:

my $hashRef = stupid_sub();
my %myHash = %$hashRef;

in to one line, as in, can I kind of automatically dereference the hash reference I'm getting? Or alternatively, how could I use "exists" on a hash reference? Can I dereference it inline? (as in, I want to use exists (somehow dereference $hashRef to get the actual hash){$key}

(This post was edited by perlFun on Jun 19, 2013, 10:53 AM)

Edit Log:
Post edited by perlFun (User) on Jun 19, 2013, 10:53 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives