COPYRIGHT NOTICE
The Copyright for Part 1 of PiHKAL has been reserved in all forms and it may not be distributed. Part 2 of PiHKAL may be distributed for non-commerical reproduction provided that the introductory information, copyright notice, cautionary notice and ordering information remain attached.

CAUTIONARY NOTE: READ BEFORE PROCEEDING
At the present time, restrictive laws are in force in the United States and it is very difficult for researchers to abide by the regulations which govern efforts to obtain legal approval to do work with these compounds in human beings.... No one who is lacking legal authorization should attempt the synthesis of any of the compounds described in these files, with the intent to give them to man. To do so is to risk legal action which might lead to the tragic ruination of a life. It should also be noted that any person anywhere who experiments on himself, or on another human being, with any of the drugs described herin, without being familiar with that drug's action and aware of the physical and/or mental disturbance or harm it might cause, is acting irresponsibly and immorally, whether or not he is doing so within the bounds of the law. -- Alexander T. Shulgin

ABOUT THIS VERSION OF PiHKAL
This is an online version of the second half of the book "PiHKAL: A Chemical Love Story" by Alexander and Ann Shulgin. It is presented with the express permission of the authors in order to spread the factualinformation as widely as possible and make it permanently available in the public domain. It was originally transcribed into ASCII by Simson Garfinkle and was converted into HTML by Lamont Granquist and noded on Everything2 by Daniel Drucker.

ORDERING INFORMATION
The first half of PiHKAL is an excellent commentary on the Shulgin's personal experiences with phenethylamines. It is highly recommended and well worth purchasing the book. Purchasing the book also gets you a far more complete cross-index into the chemicals described in the second half. If you are seriously interested in the chemistry contained in these files, you should order a copy. The book may be purchased for $21.05 including postage and handling, through Mind Books. Or it can be ordered through Transform Press, for $22.95 ($18.95 + $4 p&h U.S., $8 p&h overseas). Box 13675, Berkeley, CA 94701. (510)934-4930 (voice), (510)934-5999 (fax). California residents please add $1.56 State sales tax.

Several years ago, Alexander Shulgin graciously made the PiHKAL recipes freely available. When I decided to autonode it and make it available here on E2, I realized that fast-and-dirty cut and paste wouldn't do the trick. With nearly two hundred recipes, each hundreds or even thousands of words long, though, how can one hardlink appropriately without expending unreasonable effort? Appropriately is key. Itwouldbeeasytosimplyhardlinkeverysingleword. It'd also be annoying and nearly useless. Instead, one must link only those words which one might concievably be interested in.

What I came up with is perhaps not optimal, but it's certainly a workable compromise. I ...

# take an input line that looks like this:
# [[3,5-[dimeth]oxy-4]-[allyloxy[[[phen]yl][aceto[nitrile]]]]] as a yellow
# and return one that looks like this:
# [3,5-dimethoxy-4-allyloxyphenylacetonitrile] as a yellow
while (<STDIN>) {
$inside = 0;
chomp;
@x = split(//);
# start at the beginning of the line ($x[0]), and walk forward.
# if we hit a [, do $inside++. if $inside is greater than 1,
# delete the [. if we hit a ], do $inside--. if $inside is greater
# than 0, delete the ].
for $i (@x) {
if ($i eq "[") {
$inside++;
if ($inside > 1) {
$i = "";
}
} elsif ($i eq "]") {
$inside--;
if ($inside > 0) {
$i = "";
}
}
}
print join('',@x),"\n";
}