Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: more fun with references and hashes

by malloc (Pilgrim)
on May 30, 2001 at 23:34 UTC ( [id://84355]=note: print w/replies, xml ) Need Help??


in reply to more fun with references and hashes

To my knowledge, you cannot return a hash, you have to return a reference from your sub, so return \%new_hash, and in your main code:
my $ref = duplicate_probe_signals(\%clocks); my %new_hash = %$ref;
Hope this helps.. -malloc

Replies are listed 'Best First'.
Re: Re: more fun with references and hashes
by larryk (Friar) on May 30, 2001 at 23:57 UTC
    It is possible to return a hash...
    #!perl -w use strict; use Data::Dumper; sub test { my %hash = ( a => 1, b => 2, c => 3, ); return %hash; } my %got_this = &test; print Dumper( \%got_this );
    The hash returned is simply a list that happens to have an even number of values (and unique values in the key positions 0,2,4,6,8etc.).

    "Argument is futile - you will be ignorralated!"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://84355]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found