| 1 | <HTML> |
| 2 | <HEAD> |
| 3 | <TITLE>How about an example for output?</TITLE> |
| 4 | </HEAD> |
| 5 | <BODY> |
| 6 | |
| 7 | <P><B>Links</B>: <A HREF=skel.html>Next</A> <A HREF=popoutput.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P> |
| 8 | |
| 9 | <H1>How about an example for <TT>output</TT>?</H1> |
| 10 | |
| 11 | <P>Here is a simple example to demonstrate how <A HREF=output.html><TT>output</TT></A>, <A HREF=pushoutput.html><TT>push_output</TT></A>, and |
| 12 | <A HREF=popoutput.html><TT>pop_output</TT></A> work:</P> |
| 13 | |
| 14 | <P> |
| 15 | <PRE>output "Hello, world!\n"; # (Written to STDOUT by default) |
| 16 | push_output('nul'); # Push 'nul' ahead of STDOUT |
| 17 | output "Hello, again!\n"; # (Discarded) |
| 18 | push_output('file','foo.out'); # Push file 'foo.out' ahead of 'nul' |
| 19 | output "Hello, again!\n"; # (Written to the file 'foo.out') |
| 20 | pop_output; # Pop 'foo.out' and revert to 'nul' |
| 21 | output "Hello, again!\n"; # (Discarded) |
| 22 | push_output('string'); # Push 'string' ahead of 'nul' |
| 23 | output "Hello, "; # (Written to the string) |
| 24 | output "again!\n"; # (Also written to the string) |
| 25 | # Pop the string "Hello, again!\n" |
| 26 | $foo = pop_output; # and revert to 'nul' |
| 27 | output "Hello, again!\n"; # (Discarded) |
| 28 | pop_output; # Pop 'nul' and revert to STDOUT |
| 29 | output "Hello, at last!\n"; # (Written to STDOUT)</PRE> |
| 30 | </P> |
| 31 | |
| 32 | <P><B>Links</B>: <A HREF=skel.html>Next</A> <A HREF=popoutput.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P> |
| 33 | |
| 34 | |
| 35 | <ADDRESS>David Megginson <A HREF="mailto:[email protected]"><[email protected]></A></ADDRESS> |
| 36 | </BODY> |
| 37 | </HTML> |