well here is the problem, i want to make the below code work. the idea is that i want to pass some argument into sub which then does what it does and passes the result in the array that is every time the foreach func starts canceled to no arguments. i could do it without strict pragma but the strict pragma has to stay. example:
this example doesn't work because of @big (it should be: my @big). i tried to make it our @big but the logic is not on my side.use strict; %hash -> here i have some hash my @array = qw(...); my $a = 1; foreach my $r (@array){ walk($r); @big;<----------------------------------- foreach my $b (@big){ | $a++; | print " I am $b that loves $a\n"; | } | } | | | sub walk { | | my $i = shift; | push @big, $i;------------------------------- for (@{$hash{$i}}){ walk($_) }
thnx
In reply to subroutine recursion question by baxy77bax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |