Forms. The present perfect subjunctive is formed by using the present
subjunctive of the helping verb
haber with the past (or passive) participle:

yo

haya

hablado
comido
vivido

I (have) spoken/eaten/lived, etc.

tú

hayas

él/ella/usted

haya

nosotros/vosotras

hayamos

vosotros/vosotras

hayáis

ellos/ellas/ustedes

hayan

Uses. The present perfect subjunctive is used in the same types of
clauses as the present subjunctive, and normally is used: to indicate the
action as completed with governing verbs in the present or future tense or
command forms. Examples:

Me alegro de

que ella haya llegado.

I'm glad she (has) arrived.

Dudo

I doubt she (has) arrived.

Niego

I deny she (has) arrived.

Es posible

It's possible she (has) arrived.

Lo haré después

I'll do it after she has arrived.

No lo hagas a menos

Don't do it unless she has arrived.

When to use which present subjunctive. The simple present
subjunctive is used to indicate an action viewed as occurring at the same
time or in the future when the governing verb is in the present, present
perfect, future, future perfect, or a command form; the present perfect
subjunctive is used to indicate an action viewed as having ocurred previously
when the governing verb is in those same tenses:

Tense of the governing verb

Subjunctive tense to use in the subordinate clause

present (indicative or subj.)

present subjunctive [for a simultaneous or future state
or action]ORpresent perfect subjunctive [for a prior state or action]

Forms of the imperfect subjunctive. Take the third person plural form
of the preterit (e.g., hablaron), then drop the -on from the
end, which gives you the stem (hablar-) for the imperfect subjunctive.
The endings are the same for all verbs: -a, -as,
-a, -amos, -ais, -an.

Uses of the imperfect subjunctive. The imperfect subjunctive is used
in the same type of situations in which the present subjunctive is used,
except that the governing verb is typically in a past tense (e.g., the preterit,
imperfect, past perfect, conditional, conditional perfect, or one of the
past subjunctives):

Noun clauses. Remember that the subjunctive is used after verbs of influence,
emotion, doubt, and denial. Contrast the use of the present tense governing
verb plus present subjunctive situation and that of a past tense governing
verb and the imperfect subjunctive.

Quiero

que él lo haga. (present subj.)

I want him to do it.

Me alegro de

I'm glad he's doing it.

Dudo

I doubt he's doing it.

Niego

I deny he's doing it.

Es importante

It's important for him to do it.

Quería

que lo hiciera. (imperf. subj.)

I wanted him to do it.

Me alegraba de

I was glad he did it.

Dudaba

I doubted he'd do it.

Negué

I denied he did it (was doing it).

Era importante

It was important for him to do it.

Adverbial clauses (time, purpose, etc.). Remember that the subjunctive is
used when the action in the adverbial clause is viewed as anticipated or
hypothetical. Again, contrast the present time and past time situations:

Lo haremos

cuando

vengan.(present)

We'll do it

when they come.

después que

afterthey come.

mientras

whilethey come.

Lo haríamos(or: Íbamos a hacerlo)

cuando

vinieran.(imperfect)

We were going to do it

when they came.

despues que

after they came.

mientras

while they werecoming.

Lo hacemos

para que

vengan.(present)

We do it

so they will come.

sin que

without them coming.

con tal que

provided they come.

Lo hicimos

para que

vinieran. (impefect)

We did it

so they'd come.

sin que

without them coming.

con tal que

provided they'd come.

Adjectival clauses. Remember that the subjunctive is used when there is a
negated or indefinite antecedent. Again, contrast the present time and past
time situations:

Forms. The past perfect subjunctive is formed by using the imperfect
subjunctive of the helping verb
haber with the past (or passive) participle:

yo

hubiera

hablado/comido/vivido

I had spoken/eaten/lived, etc.

tú

hubieras

él/ella/usted

hubiera

nosotros/vosotras

hubiéramos

vosotros/vosotras

hubierais

ellos/ellas/ustedes

hubieran

Uses. Similar to the past perfect indicative, this tense is may be
used to indicate an action or state that occurred prior to something in the
past (usually expressed by the imperfect or preterit indicative, or by the
past subjunctive):

Dudábamos que hubieran llegado.

We doubted that they had come.

Nos gustó que todo hubiera salido bien.

We were glad that all had turned out OK.

When to use what past subjunctive: imperfect subjunctive
or past perfect subjunctive.

WHEN THE GOVERNING VERB IS IN A PAST TENSE AND THE SUBJUNCTIVE
IS REQUIRED, A PAST SUBJUNCTIVE IS ALMOST ALWAYS USED:

tense of the governing verb

subjunctive tense to use in the subordinate clause

imperfect (indicative or subj.)

imperfect subjunctive [for a simultaneous or future
state or action]ORpast perfect subjunctive [for a prior state or action]

preterit

past perfect (indic. or subj.)

conditional

conditional perfect

Nos impresionó que tú cantaras.

We were impressed that you were singing [ORsangORwould singORwere going to sing.]

Nos impresionó que tú hubieras cantado.

We were impressed that you had sung.

We will look at conditional sentences (ifclauses) elsewhere.
Meanwhile, however, remember that como si (as if)
MUST be followed by one of the two past subjunctive
tenses, the imperfect or the past perfect:

El habla como si fuera rico.

He talks as if he were rich.

Ella habla como si hubieravivido en México.

She talks as if she has (had) lived in Mexico.

Ojalá and the subjunctive. Ojalá plus the present
subjunctive or the present perfect subjunctive is used in the sense of I
hope; with the two past subjunctive tenses, it means I wish,
and implies that something is hypothetical or contrary-to-fact:

Ojalá que esté aquí.

I hope she is here. [She might be here.]

Ojalá que haya estado aquí.

I hope she has been here. [She may have been here.]

Ojalá que estuviera aquí.

I wish she were here. [She's not here.]

Ojalá que hubiera estado aquí.

I wish she had been here. [She has not been here.]

Caution: Do not read past this point!

Well, you may read if you wish. There are two other subjunctive forms you
will run across in reading, but you will not need them for writing Spanish
compositions at this level. They are included here strictly for information
purposes.

Another imperfect subjunctive is often seen in literature; for our present
purposes it is used in the same way as the -ra imperfect subjunctive,
and is formed the same way, by using the preterit third-person plural minus
-ron as the stem, but using -se endings rather than -ra:

The future subjunctive (el futuro de
subjuntivo). Fortunately for students, the present subjunctive has taken
over most functions of the future subjunctive, but you may see it in literature.
The root is the same as for the imperfect subjunctives (take the third-person
plural preterit form, and drop -on); the endings are based on
-e: