mikejones has asked for the wisdom of the Perl Monks concerning the following question:
thank you in advance!
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; <snip> else { print "USING LAST ELSE\n"; $size_input = ( int 25 * ( 1024**2 ) ) ; $size_input =~ tr /\000//d ; sub wanted ; File::Find::find({wanted => \&wanted}, $fs_input ) ;
###-- Tried and does not work => File::Find::find({wanted => \&want +ed}, $fs_input, $size_input ) ; --### } sub wanted { ( $fs_input ) = shift @_ ; print "FSINPT:\t",$fs_input,"\n"; for my $key ( sort keys %mounts ) { if ( $fs_input eq $key ) { @mounts = grep {$fs_input} @{ $mounts{$key} } ; } } ###-- End For my key --### if ( scalar @mounts > 0 ) { die "To bad, your dead", join( ":", @mounts ), "\n\nI said your dead $!" ; } else { ( $size_input ) = shift @_ ; my ($dev,$ino,$mode,$nlink,$uid,$gid); (( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) && ( $dev >= 0 ) && !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) && ( int(((-s _) + 1023) / 1024 ) > 26367 ) && ###-- only works when a hard-coded value is used --###
###-- ( int(((-s _) + 1023) / 1024 ) > $size_input )--### ###-- GET ERROR if $size_input is used: Use of ###-- uninitialized value in numeric gt (>) push ((@large_files), $name); } } ###-- End sub --### print scalar @large_files; print join("\n",@large_files); exit; <snip>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing argument to sub wanted
by ikegami (Patriarch) on May 14, 2008 at 14:26 UTC | |
|
Re: passing argument to sub wanted
by mirod (Canon) on May 14, 2008 at 15:06 UTC | |
by mikejones (Scribe) on May 16, 2008 at 19:40 UTC | |
by mikejones (Scribe) on May 15, 2008 at 15:50 UTC | |
by mikejones (Scribe) on May 14, 2008 at 15:49 UTC | |
|
Re: passing argument to sub wanted
by starbolin (Hermit) on May 14, 2008 at 15:39 UTC | |
by Jenda (Abbot) on May 21, 2008 at 02:01 UTC | |
|
Re: passing argument to sub wanted
by svenXY (Deacon) on May 14, 2008 at 14:10 UTC | |
by ikegami (Patriarch) on May 14, 2008 at 14:29 UTC |