Sophie

Sophie

distrib > Mandriva > 9.0 > x86_64 > media > main > by-pkgid > b476a1a7ee06ea1d2924bb8a579e6ae4 > files > 48

perl-SGMLSpm-1.03ii-3mdk.noarch.rpm

<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">&lt;dmeggins@aix1.uottawa.ca&gt;</A></ADDRESS>
</BODY>
</HTML>