Re: Small plperl documentation patch

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Small plperl documentation patch
Дата
Msg-id 0d05fed147610fb3c8bbe2b5a0ff5d20@biglumber.com
обсуждение исходный текст
Ответ на Re: Small plperl documentation patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Small plperl documentation patch  (Andrew Dunstan <andrew@dunslane.net>)
Список 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@turnstep.com
PGP Key: 0x14964AC8 200510182220
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFDVa2qvJuQZxSWSsgRAoMSAJ4i+TlQOYUw5w8VCLqsSKakfgaWfQCfeqGo
n5Rn3XwUZZgwdHrs/7i3GNI=
=/0mE
-----END PGP SIGNATURE-----



В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Small plperl documentation patch
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Small plperl documentation patch