업무/Perl
[perl] 핸들변수 함수인자로 넘겨버리기
랄프위검
2012. 2. 2. 18:57
쓸때가 생기더라구요.ㅎㅎ
sub TEST($)
{
my ($var_file) = @_;
print $var_file "Hello world\n";
}
MAIN:
{
local(*F);
if ( !open (F, "/usr/local/test.txt" )) {
print "ERROR : OPEN FILE(/usr/local/test.txt)\n";
exit(0);
}
TEST(F);
close(F);
}