Easy to do. The PPM man page seems to assume you will always be dealing with binary (P6), it does not even realy mention the format details of a ASCII version of PPM. I use ASCII NetPPM images all the time as a mthod of creating images from raw data using shell scripts.
One other thing to note is that P3 (ASCII format) only does argument separation based on white space, not newlines. that is you can use spaces, tabs, returns or newlines to separate any and all arguments and data.
You can have the image on a single line, or every argument on a separate line. no problems.
the only other thing to really keep in mind is that it has a maximum resolution limit of 16 bit (65535) though ANY range maximum can also be used (it does not have to be 2^n-1 as is the case in IM). I have sometimes used this to generate images with only 5 greyscale range, or generate a image based on percentages (0 to 100). It is very versitile!
For one example. I extract morphology kernels from IM (see
http://www.imagemagick.org/Usage/morphology/#showkernel ) and convert them into enlarged images for use in IM examples via a PPM in a "kernel2image" script. See
http://www.imagemagick.org/Usage/morpho ... rnel2image for details.
Script is located at
http://www.imagemagick.org/Usage/scripts/kernel2image