[Wellington-pm] The Perl Way: References & subroutines
Kevin Dorne
sweetpea-perl at tentacle.net
Sun Feb 20 19:46:12 PST 2005
Hi folks,
A pretty simple question, I hope.
I'm writing a subroutine that fetches some data externally and returns it as a hash. I'm just not sure the best way to do this in Perl. For example,
my %nxt = fetch_next();
sub fetch_next {
...
my %msg = ( 'a' => 'b', );
return %msg;
}
vs
my $msg = fetch_next();
sub fetch_next {
...
my $msg = { 'a' => 'b', };
return $msg;
}
vs
my %msg;
fetch_next(\%msg);
sub fetch_next {
my $msg = shift;
...
}
and so on. Suggestions?
--
Peace, love & happiness to you from me =)
-Sweetpea http://sweetpea.tentacle.net
"Conformation needed ASAP... please reply!" - Spam
More information about the Wellington-pm
mailing list