Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^5: Returning values from a sub routine.

by suaveant (Parson)
on Jul 31, 2012 at 19:38 UTC ( #984652=note: print w/ replies, xml ) Need Help??

in reply to Re^4: Returning values from a sub routine.
in thread Returning values from a sub routine.

sub test { my (@names_all, @email_all); my @names = qw(Joe mary ann pete amy jerry Joe ann John John ); my @email = qw( ann@nowhere. +com; my %emails; my @names_combined = (@names,@names_all); my @emails_combined = (@email,@email_all); for my $name ( @names_combined ) { push @{$emails{$name}}, shift(@emails_combined); } return \%emails; }
Not tested, but should get you going in the right direction. Maybe read some Perl tutorials or Learning Perl to get a better overall feel for the language.

                - Ant
                - Some of my best work - (1 2 3)

Comment on Re^5: Returning values from a sub routine.
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-11-25 22:18 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (692 votes), past polls