Hi,
I have a program that has six open file handles that I need to make the same regex pattern match on. So to avoid writing the pattern match six times I have a function that does the pattern match, but how do you pass a file handle to a subroutine? Something that would look like this:
[tt]
sub search {
while (<some passed file handle>) {
#do something
}
return ("something"
;
}
$variable1 = &search(<filehandleA>);
$variable2 = &search(<filehandleB>);
$variable3 = &search(<filehandleC>);
[/tt]
any ideas?
fortytwo
will@hellacool.co.uk
I have a program that has six open file handles that I need to make the same regex pattern match on. So to avoid writing the pattern match six times I have a function that does the pattern match, but how do you pass a file handle to a subroutine? Something that would look like this:
[tt]
sub search {
while (<some passed file handle>) {
#do something
}
return ("something"
}
$variable1 = &search(<filehandleA>);
$variable2 = &search(<filehandleB>);
$variable3 = &search(<filehandleC>);
[/tt]
any ideas?
fortytwo
will@hellacool.co.uk