<HTML> <HEAD> <TITLE>How about an example for output?</TITLE> </HEAD> <BODY> <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> <H1>How about an example for <TT>output</TT>?</H1> <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 <A HREF=popoutput.html><TT>pop_output</TT></A> work:</P> <P> <PRE>output "Hello, world!\n"; # (Written to STDOUT by default) push_output('nul'); # Push 'nul' ahead of STDOUT output "Hello, again!\n"; # (Discarded) push_output('file','foo.out'); # Push file 'foo.out' ahead of 'nul' output "Hello, again!\n"; # (Written to the file 'foo.out') pop_output; # Pop 'foo.out' and revert to 'nul' output "Hello, again!\n"; # (Discarded) push_output('string'); # Push 'string' ahead of 'nul' output "Hello, "; # (Written to the string) output "again!\n"; # (Also written to the string) # Pop the string "Hello, again!\n" $foo = pop_output; # and revert to 'nul' output "Hello, again!\n"; # (Discarded) pop_output; # Pop 'nul' and revert to STDOUT output "Hello, at last!\n"; # (Written to STDOUT)</PRE> </P> <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> <ADDRESS>David Megginson <A HREF="mailto:dmeggins@aix1.uottawa.ca"><dmeggins@aix1.uottawa.ca></A></ADDRESS> </BODY> </HTML>