From: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Small plperl documentation patch |
Date: | 2005-10-19 02:21:35 |
Message-ID: | 0d05fed147610fb3c8bbe2b5a0ff5d20@biglumber.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tom Lane asked:
> Please, tell me that isn't so. $a is a reserved name now? What was
> Larry thinking?
It's not that bad, really. $a and $b have special meaning inside of
a sort subroutine as the two items being compared. Thus, you can write
something like this:
my @crooks = sort { lc $a cmp lc $b } @whitehouse;
to create a list sorted by lowercase (albeit not in the most efficient
matter). This will work even with "use strict" turned on, as $a and $b
will not trip Perl's strict-mode checking of undeclared variables. So,
the danger is very minor, but it's a good practice to not use them for
temporary variables in a script.
- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200510182220
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFDVa2qvJuQZxSWSsgRAoMSAJ4i+TlQOYUw5w8VCLqsSKakfgaWfQCfeqGo
n5Rn3XwUZZgwdHrs/7i3GNI=
=/0mE
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2005-10-19 14:40:42 | Re: Small plperl documentation patch |
Previous Message | Tom Lane | 2005-10-19 02:08:34 | Re: Small plperl documentation patch |