| Subject: | [svn:perlfaq] r11451 - perlfaq/trunk |
|---|---|
| From: | comdog@xxxxxxxxxxxx |
| Date: | Tue, 24 Jun 2008 09:53:15 -0700 (PDT) |
| Newsgroups: | perl.cvs.perlfaq |
Author: comdog
Date: Tue Jun 24 09:53:14 2008
New Revision: 11451
Modified:
perlfaq/trunk/perlfaq5.pod
Log:
* perlfaq5: How can I open a filehandle to a string?
+ Recasting Peter's lead paragraph with another that
he supplied.
Modified: perlfaq/trunk/perlfaq5.pod
==============================================================================
--- perlfaq/trunk/perlfaq5.pod (original)
+++ perlfaq/trunk/perlfaq5.pod Tue Jun 24 09:53:14 2008
@@ -557,13 +557,13 @@
See L<perlform/"Accessing Formatting Internals"> for an C<swrite()> function.
=head2 How can I open a filehandle to a string?
-X<string> X<open> X<IO::Scalar> X<filehandle>
+X<string> X<open> X<IO::String> X<filehandle>
(contributed by Peter J. Holzer, hjp-usenet2@xxxxxx)
-Since Perl 5.8.0, you can pass a reference to a scalar instead of the
-filename to create a file handle which you can used to read from or write to
-a string:
+Since Perl 5.8.0 a file handle referring to a string can be created by
+calling open with a reference to that string instead of the filename.
+This file handle can then be used to read from or write to the string:
open(my $fh, '>', \$string) or die "Could not open string for writing";
print $fh "foo\n";
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [svn:perlfaq] r11447 - perlfaq/trunk, comdog |
|---|---|
| Next by Date: | [svn:perlfaq] r11470 - perlfaq/trunk, comdog |
| Previous by Thread: | [svn:perlfaq] r11447 - perlfaq/trunk, comdog |
| Next by Thread: | [svn:perlfaq] r11470 - perlfaq/trunk, comdog |
| Indexes: | [Date] [Thread] [Top] [All Lists] |