f



Are there any differences between a built-in function and a user-defined subroutine?

Besides the fact that built-in functions are predefined and are part of the=
 language, are there any characteristic differences between them? Given b_f=
ct  a built-in function, and u_fct a user-defined function, are there any p=
roperties that I can programmatically query to show that b_fct is built-in =
function, and similarly for u_fct? This question is just a curiosity.
0
An
12/10/2016 8:33:45 PM
comp.lang.perl.misc 33233 articles. 1 followers. brian (1246) is leader. Post Follow

1 Replies
360 Views

Similar Articles

[PageSpeed] 44

On 10/12/2016 22:33, An Luutran wrote:
> Besides the fact that built-in functions are predefined and are p
>



#!/usr/bin/perl
use feature qw/say/;
sub f1 {}

say TestFunctions('f1');
say TestFunctions('hex');
say TestFunctions('f2');

sub TestFunctions {
__PACKAGE__->can("CORE::$_[0]") ? 'built in':
__PACKAGE__->can($_[0]) ? 'user':'not exist'
}
0
George
12/11/2016 9:47:31 PM
Reply: