Hi,
update:checking File::Find, I now think that find(\%options, @directories); is more what you should try to do...

you need to pass it as a parameter to the wanted() call like:
#!/usr/bin/perl use strict; use warnings; use File::Find; use vars qw/*name *dir *prune/ ; *name = *File::Find::name ; *dir = *File::Find::dir ; *prune = *File::Find::prune ; my $size_input; my $fs_input = '/tmp'; $size_input = ( int 25 * ( 1024**2 ) ) ; $size_input =~ tr /\000//d ; sub wanted ; File::Find::find({wanted => \&wanted($size_input)}, $fs_input ) ; sub wanted { my ($size_input ) = @_ ; print "FSINPT:\t",$fs_input,"\n"; print "SizeINPT:\t",$size_input,"\n"; return; } ###-- End sub --###
at least returns the following:
FSINPT: /tmp SizeINPT: 26214400 Odd number of elements in anonymous hash at 686513.pl line 17. Use of uninitialized value in subroutine entry at /usr/share/perl/5.8/ +File/Find.pm line 822. Can't use string ("") as a subroutine ref while "strict refs" in use a +t /usr/share/perl/5.8/File/Find.pm line 822.
so the size parameter has been "accepted" by wanted.

Regards,
svenXY

In reply to Re: passing argument to sub wanted by svenXY
in thread passing argument to sub wanted by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.