in reply to Re: How do I treat a string like a filehandle?
in thread How do I treat a string like a filehandle?
But again, this forks (as does yours), and it's much better to use IO::Stringy to do it all within one process.my $fh = FileHandle->new or die "Cannot create filehandle: $!"; defined(my $pid = open($fh, "-|")) or die "Cannot fork: $!"; unless ($pid) { print <<'EOD'; One fish Two fish Red fish Blue fish EOD exit 0; } print $_ while <$fh>; # in parent
-- Randal L. Schwartz, Perl hacker
|
---|