johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
Usually I open a file/socket and pass it to this method. But sometimes I just want to get the whole result as a string. Is there something like java's java.io.StringWriter, where I can use it as a file handle? (Of couse, I can also just rewrite the method to produce a string, but...)sub subroutine { my $fh = shift; print $fh "Hello, filehandle!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can a string be a file hanle?
by CombatSquirrel (Hermit) on Sep 26, 2004 at 22:46 UTC | |
by JediWizard (Deacon) on Sep 26, 2004 at 23:14 UTC | |
by graff (Chancellor) on Sep 26, 2004 at 23:40 UTC | |
by ambrus (Abbot) on Sep 27, 2004 at 19:26 UTC | |
by JediWizard (Deacon) on Sep 27, 2004 at 20:28 UTC | |
|
Re: Can a string be a file hanle?
by Arunbear (Prior) on Sep 26, 2004 at 22:34 UTC | |
by johnnywang (Priest) on Sep 27, 2004 at 00:27 UTC | |
|
Re: Can a string be a file hanle?
by JediWizard (Deacon) on Sep 26, 2004 at 22:47 UTC | |
|
Re: Can a string be a file hanle?
by Happy-the-monk (Canon) on Sep 26, 2004 at 22:32 UTC | |
|
Re: Can a string be a file hanle?
by and11 (Initiate) on Sep 27, 2004 at 20:32 UTC |