Home > Archive > PERL Beginners > October 2006 > Glob Question/Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Glob Question/Problem
|
|
| away_man 2006-10-04, 11:52 am |
| Here's my code:
my $files = glob('/directoryname/*');
print "$files\n;"
It sort of works, but only returns the file whose name is highest in alphabetical order in that directory. Shouldn't it return _all_ the files in that directory?
I suspect my problem is related to this entry from the manpage:
"In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted."
I tried creating a loop and having it print $file each time it loops, but it still just returns the one filename each time.
What I'm actually trying to do is copy (and then delete) all files from the directory in question, but that script didn't work completely, so I wrote this small one just to check my glob syntax.
Thanks in advance for any help, and I apologize if this is something I should figure out without bugging y'all, but I started teaching myself Perl about 4 days ago, and need to get this particular program up and running asap. | |
| away_man 2006-10-09, 10:55 am |
| Okay, so either this question was so basic that it wasn't deemed worthy of a response, or I've stumped you all.
Anyone care to let me know which? | |
| away_man 2006-10-09, 3:19 pm |
| quote: Originally posted by away_man
Okay, so either this question was so basic that it wasn't deemed worthy of a response, or I've stumped you all.
Anyone care to let me know which?
Never mind. I finally did the magic Google search to find a reference for what I needed to do.
Thanks for all the incredibly helpful assistance with my issue. |
|
|
|
|