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: Perl Programming Help: Beginner: Re: [KevinR] extract data...: Edit Log



AWHF
Novice

Jun 25, 2007, 6:34 PM


Views: 3661
Re: [KevinR] extract data...

sorry!
what i'm trying to mean that is i want to open all the files in a directory which the name ended by .doc.
let's say the file called "file1.doc", "file2.doc", "file3.doc", .... and the directory called "document". i had try out this script but it could not function. there is nothing in the "result"

Code
  #!/usr/bin/perl   
my $dirname = "/eng/png/home/awhf/document";
chdir ($dirname) || die "can't chdir to $dirname: $!";
opendir(DIR, $dirname) || die "can't open directory: $!";
my @files = grep {/\.doc$/} readdir DIR;
close DIR;
open(OUT, ">>/eng/png/home/awhf/result") || die "can't open: $!";
while (<@files>)
{
s/\s*(\w+).*/$1/;
if (/^::start/../^end/)
{
print OUT;
}
}
close OUT



(This post was edited by AWHF on Jun 25, 2007, 6:40 PM)


Edit Log:
Post edited by AWHF (Novice) on Jun 25, 2007, 6:39 PM
Post edited by AWHF (Novice) on Jun 25, 2007, 6:40 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