[Wellington-pm] The Perl Way: References & subroutines

Srdjan srdjan at catalyst.net.nz
Sun Feb 20 20:12:47 PST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



|  > vs
|  > my %msg;
|  > fetch_next(\%msg);
|  > sub fetch_next {
|  >   my $msg = shift;
|  >   ...
|  > }
|
| I would suggest using (2) unless all of this code happens to be in a bigger
loop. In which case (3) would save re-creating the hash everytime and (2) would
be slightly slower.

I wold suggest using (2) *always*. It's by no means slower then (3), because you
would have to clean the hash before assigning new values, or go through a hassle
of making sure to always set values for specified keys.

|
| Depending on how big %msg/$msg is, I wouldn't be too worried. I'd say to go
for (2) or (3) though. My preference would be (2) unless it was all in a loop
itself.
|
| Andy
|
| _______________________________________________
| Wellington-pm mailing list
| Wellington-pm at pm.org
| http://mail.pm.org/mailman/listinfo/wellington-pm
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCGV++ZtcHxCitRpgRAmEuAJ9+pUVj0KfYpXvxapC5rDKQ+5I7hwCeLv/Z
ICH7RopRmPvvPn+xx5Qa3tA=
=hcY9
-----END PGP SIGNATURE-----


More information about the Wellington-pm mailing list