How to create a Perl subroutine that accepts a block of code

后端 未结 4 818
猫巷女王i
猫巷女王i 2021-02-01 06:12

I have a set of subroutines that look like this:

sub foo_1($) {
  my $name = shift;
  my $f; 

  run_something();
  open($f, $name) or die (\"Couldn\'t open $nam         


        
4条回答
  •  借酒劲吻你
    2021-02-01 06:48

    Although others already answered the question I was still missing the reference to the official Perl documentation.

    http://perldoc.perl.org/perlsub.html#Prototypes

提交回复
热议问题