Skip site navigation (1) Skip section navigation (2)

Re: Small plperl documentation patch

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 (view raw or flat)
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-----



In response to

Responses

pgsql-patches by date

Next:From: Andrew DunstanDate: 2005-10-19 14:40:42
Subject: Re: Small plperl documentation patch
Previous:From: Tom LaneDate: 2005-10-19 02:08:34
Subject: Re: Small plperl documentation patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group