fork download
  1. use warnings;
  2. use strict;
  3.  
  4. my @array = (1,2,3,4,5);
  5. my $v = 1;
  6.  
  7. sub by_ref
  8. {
  9. my ($array_ref,$v) = @_;
  10. print "$array_ref[1]";
  11. @$array_ref = (0,0,0);
  12. print "Array inside by_ref: @$array_ref\n";
  13. }
  14. my @b = @array;
  15. by_ref(\@b,$v);
  16. @array = @b;
  17.  
  18. print "Array changed: @array\n";
Runtime error #stdin #stdout 0s 4684KB
stdin
Standard input is empty
stdout

Standard output is empty