fork(1) download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. sub get_ingredient_list {
  6. my @arr = ('1', '2', '3');
  7. return @arr;
  8. }
  9.  
  10. sub for_each {
  11. my $arr = shift;
  12. my $b = shift;
  13. print(scalar(@{$arr}), "\n");
  14. return $b;
  15. }
  16.  
  17. print for_each(\@{get_ingredient_list}, 'abc');
Runtime error #stdin #stdout #stderr 0s 6132KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Ambiguous use of @{get_ingredient_list} resolved to @get_ingredient_list at prog.pl line 17.
Variable "@get_ingredient_list" is not imported at prog.pl line 17.
	(Did you mean &get_ingredient_list instead?)
Global symbol "@get_ingredient_list" requires explicit package name at prog.pl line 17.
Execution of prog.pl aborted due to compilation errors.