sub make_read_file_proc { my $fh = shift; return sub { if eof($fh) { $root->fileevent($fh, "readable", undef); $fh->close; $nextfile = get_next_file(); # do stuff to start processing next file # this is where I want to call myself recursively, # if I could } if () { #do stuff to process output from forked children here #right now, just print print; } else { print "error\n"; $root->fileevent($fh, "readable", undef); undef($fh); } } }