in reply to passing file handle to functions
Hi, if I have understood your question correctly then try this,
use strict; use warnings; #####Function 1############# open (FF, "sample.xml")||die $!; my @con = <FF>; close(FF); #Passing Array to a function &function1(\@con); #####Function 2############# open (FF, "sample.xml")||die $!; #Passing File handle to a function &function2(\*FF); close(FF); sub function1{ my ($con) = @_; #Dereference the array my @con = @{$con}; $,="\n"; print @con; } sub function2{ my ($con) = @_; print <$con>; }
View these How (Not) To Ask A Question and How do I post a question effectively?
Regards,
Velusamy R.
|
|---|