perl杂记
函数
#! /usr/bin/perl #传参测试 sub hello { print $_[0]; } &hello("hello,world\n"); #返回值测试 sub max { if ($_[0] > $_[1]) { return $_[0]; } else { return $_[1]; } } $n = &max(10,23); prin} test(
模拟函数指针
#! /usr/bin/perl sub hello { print $_[0]; } &hello("hello,world\n"); #模拟函数指针的测试 @funcPointer = (\&hello); $funcPointer[0]->("testing...\n");
浙公网安备 33010602011771号