[Israel.pm] convert perl string to file handle

Tal Kelrich tal at musicgenome.com
Sun Jun 6 08:39:08 PDT 2004


On Sun, 6 Jun 2004 18:16:49 +0300
Gaal Yahas <gaal at forum2.org> wrote:

> 
> This would hang on large data, because the print would block whenever
> the pipe's buffer is filled.
> 

would this be any better?

$buffer="foo";
if(open(FH,"-|")==0)
{ #child
	print FH $buffer;
	close FH;
	exit;
}
#parent, gather
print <FH>;
close FH;

-- 
Tal Kelrich
PGP fingerprint: 3EDF FCC5 60BB 4729 AB2F  CAE6 FEC1 9AAC 12B9 AA69
Key Available at: http://www.hasturkun.com/pub.txt
----
2180, U.S. History question: What 20th Century U.S. President was almost
impeached and what office did he later hold?
----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20040606/9672bda4/attachment.pgp 


More information about the Perl mailing list