Quick question -- script issue

J

jack

I pulled this script out of a larger one to test, and I can't figure it out.
If I keep this script in the same directory as the files I want to read, it
works fine, but if I move the script out of it, no dice. Am I missing
something?

Thanks

Being script:
#!/usr/bin/perl

opendir(DIR, "/Users/jack/Sites/tempdir") || die "Can't open dir -- $!";
@files = grep(/article.*\.toformat/, readdir(DIR));
closedir(DIR);

foreach $file (@files) {
open(FILE,"<$file");
my($template)=<FILE>;
print "$template";
close(FILE);
}
 
N

nobull

jack said:
Subject: Quick question -- script issue

That contains _zero_ information. No, actually that's not true. It
contains the information "I'm to selfish/lazy/arrogant to bother
thinking about my subject lines". Is that really what you wanted to
tell us?
I pulled this script out of a larger one to test, and I can't figure it out.
If I keep this script in the same directory as the files I want to read, it
works fine, but if I move the script out of it, no dice. Am I missing
something?

Manuals.

No less than half the manpage of one of the functions you are using is
devoted to forewarning you about the mistake you have just made.
Don't worry just about everyone makes the mistake the first time they
use this funtion - I know I did. The test of character is if you have
the self discipline to go RTFM when things go wrong.

Guessing which function I'm talking about is left as an execise for
the reader. (Hint, it is one that has something to do with
directories).

This newsgroup does not exist (see FAQ). Please do not start threads
here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Quick Question 7
Help with Hash 2
issue with closedir 2
Very Sluggish Code 4
Merge files 1
List of directories with a directory 3
Efficiently searching multiple files 10
Brocade Switch Perl Script 0

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top