Perl file handle question...

Ed Eddington ed at pcr7.pcr.com
Tue Jan 25 08:31:29 CST 2000


Any ideas about this? I want to grab STDOUT from a Perl script within the 
same script and do some processing on it. It would be easy if I could just 
select a filehandle at the beginning of the script so all the print 
statements would print to this filehandle. Seems like there should be a way 
to do this in memory without actually printing to a file and then 
reopening. This does NOT work...


#!/usr/bin/perl

select HANDLE;
$|=1;

print 'This is printing to the HANDLE';

select STDOUT;

$text = <HANDLE>;

print "This from the HANDLE: $text\n";                 #<-- $text is 
empty!!



If anyone knows a neat way to do this, please let me know.
Thanks!
Ed




More information about the grand-rapids-pm-announce mailing list