there is a difference between the function exit:
perldoc -f exit

and a sub you have defined by your own. even if you re-use a name of a 
build-in. thats why you called exit via &exit; and not exit; or exit();

#!/usr/bin/perl -w

sub exit(){
    print "sub exit called\n";
}

&exit;
&exit();

if ($ARGV[0] == 1) {
    exit; # way 1
}else {
    exit(); # way 2
}



[EMAIL PROTECTED] ~ % perl pang.pl 1
Ambiguous call resolved as CORE::exit(), qualify as such or use & at
pang.pl line 11. Ambiguous call resolved as CORE::exit(), qualify as
such or use & at pang.pl line 13. sub exit called
sub exit called
[EMAIL PROTECTED] ~ % perl pang.pl 2
Ambiguous call resolved as CORE::exit(), qualify as such or use & at
pang.pl line 11. Ambiguous call resolved as CORE::exit(), qualify as
such or use & at pang.pl line 13. sub exit called
sub exit called

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to