Skip to content

Commit 445b09e

Browse files
author
Father Chrysostomos
committed
perlfunc/formline: Suggest an alternate capturing method
(When I was starting to program in Perl, I wasted a lot of time trying to use formline as an alternate version of write, in order to capture the output. Eventually I created a pipe() and used that. But now we have scalar ‘filehandles’, it’s much easier.)
1 parent a7c1632 commit 445b09e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pod/perlfunc.pod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,10 @@ Be careful if you put double quotes around the picture, because an C<@>
21012101
character may be taken to mean the beginning of an array name.
21022102
C<formline> always returns true. See L<perlform> for other examples.
21032103

2104+
If you are trying to use this instead of C<write> to capture the output,
2105+
you may find it easier to open a filehandle to a scalar
2106+
(C<< open $fh, ">", \$output >>) and write to that instead.
2107+
21042108
=item getc FILEHANDLE
21052109
X<getc> X<getchar> X<character> X<file, read>
21062110

0 commit comments

Comments
 (0)