I need to exclude posts that have a custom field 'city' value of 'Melbourne'.

After much searching I think the solution might consist of 2 parts.

In functions.php :
A function to get the post IDs for all posts which have a custom field 'city' value of 'Melbourne'.

Then in my loop :
Exclude these posts using the post_not_in argument, using the returned ids from the first loop?

Is this the right approach? What is the correct code?


Question: Why do I have to explicitly add perl before the script for getops to run properly?
Answer: First, look at:

C:\> assoc .pl
.pl=Perl

Take the string on the RHS, and invoke:

C:\> ftype Perl
Perl="C:\opt\Perl\bin\perl.exe" "%1" %*

Make sure %* is there.

If not, run a cmd.exe shell as administrator, and invoke

C:\> ftype Perl=perl.exe %1 %*

See also ftype /?.