goto &func;
&func;
They two seems identical开发者_如何学C to me after some test,is that the case?
There is a substantial difference. Check here: perl-goto
You were running the wrong tests. Use caller to see what is going on.
#!/usr/bin/perl
use strict;
use warnings;
sub foo {
  my $level = 0;
  while (my $sub = (caller($level))[3]) {
    print "$sub\n";
    ++$level;
  }
  print "\n";
}
sub bar {
  print "sub:\n";
  &foo;
}
sub baz {
  print "goto:\n";
  goto &foo;
}
bar();
baz();
When you run it, you'll see something like:
$  ~/stuff/goto
sub:
main::foo
main::bar
goto:
main::foo
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论