There are two solutions.
Use a global variable.
my $size_input; sub wanted { ... $size_input ... } ... $size_input = ...; ... find({wanted => \&wanted}, $fs_input);
But using globals is undesirable.
Or have find call a function other than wanted, and have it called wanted with the parameter.
sub wanted { my ($size_input) = @_; ... $size_input ... } { my $size_input; ... $size_input = ...; ... find({wanted => sub { wanted($size_input) }}, $fs_input); }
In reply to Re: passing argument to sub wanted
by ikegami
in thread passing argument to sub wanted
by mikejones
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |