andrew has asked for the wisdom of the Perl Monks concerning the following question:
alright I have this:
Now when I tell it to print, I dont want it to print "$config{home}$user{site_id}$file". I just want it to print the file, so how can I take the $config{home}$user{site_id} out.finddir("$config{home}$user{site_id}"); sub finddir { my $root = shift; chomp ( $root ); $root = $root . '/' unless ( $root =~ m|/$| ); local *DIR; opendir ( DIR, $root ); my @userfiles = sort grep !/^\.\.?\z/, readdir DIR; foreach $file (@userfiles) { next unless ( -d "$root$file" ); print "$dir"; finddir("$root$file"); } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Find and Print Directory Names
by cjf (Parson) on Jul 07, 2002 at 17:02 UTC | |
by andrew (Acolyte) on Jul 07, 2002 at 17:19 UTC | |
by cjf (Parson) on Jul 07, 2002 at 17:29 UTC | |
by andrew (Acolyte) on Jul 07, 2002 at 17:39 UTC | |
by runrig (Abbot) on Jul 07, 2002 at 17:46 UTC | |
by ehdonhon (Curate) on Jul 07, 2002 at 19:04 UTC | |
Re: s and replace
by Aristotle (Chancellor) on Jul 07, 2002 at 17:01 UTC | |
Re: s and replace
by ehdonhon (Curate) on Jul 07, 2002 at 19:01 UTC |
Back to
Seekers of Perl Wisdom