programming-examples/perl/SystemFunction/Using eval to test whether a function is implemented.pl

9 lines
249 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/local/bin/perl
open (MYFILE, "file1") || die ("Can't open file1");
eval ("\$start = tell(MYFILE);");
if ($@ eq "") {
print ("The tell function is defined.\n");
} else {
print ("The tell function is not defined!\n");
}