Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added 'my' to foreach call, to satisfy parser

...

Code Block
bgColor#ffcccc
langperl
sub function ($@) {
  my ($item, @list) = @_;

  print "item is $item\n";
  my $size = $#list + 1;
  print "List has $size elements\n";
  foreach my $element (@list) {
    print "list contains $element\n";
  }
}

my @elements = ("Tom", "Dick", "Harry");
function( @elements);

...

Code Block
bgColor#ccccff
langperl
sub function {
  my ($item, @list) = @_;

  print "item is $item\n";
  my $size = $#list + 1;
  print "List has $size elements\n";
  foreach my $element (@list) {
    print "list contains $element\n";
  }
}

my @elements = ("Tom", "Dick", "Harry");
function( @elements);

...