Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

20 Oct 2005

Passing a filehandle as parameter

To keep things maintainable we split our program in modules, classes, functions… In perlsub from the execellent perl documentation you can lookup the syntax of how to use functions. Offcourse, you have to digg pretty deep to find out how you can pass a filehandle

# clientproc(*STDOUT);
# pass the socket
clientproc(*CH);

sub clientproc  
{
  $fh = shift;  
  print $fh 'hello world';
}