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...: Perl Directory Tree Program: Edit Log



perlbegginer02
New User

Nov 29, 2013, 12:47 PM


Views: 15260
Perl Directory Tree Program

Hello everyone, I'm new to writing perl scripts and I need help with a program assignment.

The assignment is to Develop a program to analyze the directory structure of a Linux disk and identify any files larger that 500kbytes. But I need to use a for each loop and sub routine within the program.

I have only gotten up to this but, I'm not sure if its the right direction or not.


Code
#!/usr/bin/perl 
use warnings;

my $directory = '/home';

opendir (DIRFH, $directory) or die "Can't open directory! $! \n";

my @direct = $directory;

for each
$directory (@direct)
{
if (-d $file) {
print "This is a directory: " . $file;
}




(This post was edited by perlbegginer02 on Nov 29, 2013, 12:49 PM)


Edit Log:
Post edited by perlbegginer02 (New User) on Nov 29, 2013, 12:49 PM


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

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