CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: Re: [perlbegginer02] Perl Directory Tree Program: Edit Log



Zhris
Enthusiast

Dec 1, 2013, 2:12 AM


Views: 15175
Re: [perlbegginer02] Perl Directory Tree Program

An approach which is out of scope of your assignment, but nonetheless shows a proper way to perform this task, which you can study later:


Code
#!/usr/bin/perl 
use strict;
use warnings;
use Cwd;
use File::Find;
use File::stat;
use Data::Dumper;

my $min_kb = 500;
my @output;
find( sub { push @output, $File::Find::name if (stat($File::Find::name)->size / 1024 >= $min_kb) }, getcwd );
print Dumper \@output;


Chris


(This post was edited by Zhris on Dec 1, 2013, 2:17 AM)


Edit Log:
Post edited by Zhris (Enthusiast) on Dec 1, 2013, 2:13 AM
Post edited by Zhris (Enthusiast) on Dec 1, 2013, 2:14 AM
Post edited by Zhris (Enthusiast) on Dec 1, 2013, 2:17 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives