Hello ,
in your examples you're opening files not dir's , to open a directory use
this instead
opendir(DIR,$dirname) or die $!;
my @content = readdir(DIR);
closedir(DIR);
then to read files inside it ,
for (@content){
print ;
}
that's it , if you need to remove (. and ..) which means the top
Wiggins d'Anconia wrote:
Please bottom post...
Daniel Kurtz wrote:
Ooh ooh ooh! One I know!
open(COMMAND, dir |);
@files = COMMAND;
Well, there's two methods that I use where I can and they are probably
more portable.
glob works well most of the time:
@files = /directory/goes/here/*;
Ryan == Ryan Frantz [EMAIL PROTECTED] writes:
Ryan I don't think that Randal was arguing that there are more UNIX vs.
Ryan Windows systems as much as he was stating that given a number of UNIX
Ryan systems vs. Windows systems, more UNIX systems have Perl
Ryan implementations.
I *was* saying
Ooh ooh ooh! One I know!
open(COMMAND, dir |);
@files = COMMAND;
Daniel
-Original Message-
From: Luinrandir [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 25, 2005 21:33
To: beginners@perl.org
Subject: Need a list of files in a dir.
How do I get the list of files in a DIR and put
Please bottom post...
Daniel Kurtz wrote:
Ooh ooh ooh! One I know!
open(COMMAND, dir |);
@files = COMMAND;
Sort of, while that *may* work it doesn't have proper error checking, is
less secure, less efficient, and less portable than many other ways,
especially those already provided.
This
-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:27 AM
To: Daniel Kurtz
Cc: beginners@perl.org
Subject: Re: Need a list of files in a dir.
Please bottom post...
Daniel Kurtz wrote:
Ooh ooh ooh! One I know!
-Original Message-
From: Luinrandir [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 2:53 PM
To: Daniel Kurtz
Cc: beginners@perl.org
Subject: Re: Need a list of files in a dir.
Thanks Daniel.. and keep on TOP POSTING!
Not to start a flame war, but it has been
Thanks Daniel.. and keep on TOP POSTING!
Gawd I hate bottom posting!
Lou Hernsen
(.. and so my children the war between the topposters and bottomposters
began
The topposters, light happy and joyous beings ; the bottomposters, smelly
and scragly
and living below the earth in tunnels and caves in
Daniel Kurtz wrote:
Ooh ooh ooh! One I know!
open(COMMAND, dir |);
@files = COMMAND;
Please tell me you're kidding.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 9:40 AM
To: Daniel Kurtz; beginners@perl.org
Subject: Re: Need a list of files in a dir.
Daniel Kurtz wrote:
Ooh ooh ooh! One I know!
open(COMMAND, dir |);
@files = COMMAND;
Please tell
Bob Showalter wrote:
Please tell me you're kidding.
Why? It works. The question asked how you can do it, not the BEST way to
do it. And after a week of Perling, this was the one way I knew. Now I
know two ways. g
daniel
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Daniel == Daniel Kurtz [EMAIL PROTECTED] writes:
Daniel Why? It works.
Not on Unix it doesn't. And there are far more Unix installations of
Perl than Windows installations of Perl.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
Daniel Why? It works.
Not on Unix it doesn't. And there are far more Unix installations of
Perl than Windows installations of Perl.
Good point.
Although... while I'm certain that a higher PERCENTAGE of Unix systems
have Perl than Windows
-Original Message-
From: Daniel Kurtz [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 3:49 PM
To: beginners@perl.org
Subject: RE: Need a list of files in a dir.
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
Daniel Why? It works.
Not on Unix it doesn't. And there
Daniel Kurtz wrote:
Bob Showalter wrote:
Please tell me you're kidding.
Why? It works. The question asked how you can do it, not the BEST way
to do it. And after a week of Perling, this was the one way I knew.
Now I know two ways. g
OK, you weren't kidding. Since you're new to Perl, you
From: Bob Showalter [mailto:[EMAIL PROTECTED]
OK, you weren't kidding. Since you're new to Perl, you get a free
pass :~)
I appreciate the indulgence g.
Seriously, though, not all of us run Perl on Windows. Your approach
is
Windows-specific.
True, I hadn't thought of that. I'm primarily a
How do I get the list of files in a DIR and put in an array?
I'm drawing a blank on my search for this.
thanks
Lou
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On Thu, 25 Aug 2005, Luinrandir wrote:
How do I get the list of files in a DIR and put in an array?
I'm drawing a blank on my search for this.
Try writing a program instead, that seems to work better than drawing.
Some people use globs in their programs for this.
What did you try?
--
Luinrandir wrote:
How do I get the list of files in a DIR and put in an array?
perldoc -f opendir
perldoc -f readdir
perldoc -f glob
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Thanks.. I'll look it over
Lou
- Original Message -
From: John W. Krahn [EMAIL PROTECTED]
To: Perl Beginners beginners@perl.org
Sent: Thursday, August 25, 2005 6:26 PM
Subject: Re: Need a list of files in a dir.
Luinrandir wrote:
How do I get the list of files in a DIR and put in an
Your a funny dude Chris.
On 8/25/05, Chris Devers [EMAIL PROTECTED] wrote:
On Thu, 25 Aug 2005, Luinrandir wrote:
How do I get the list of files in a DIR and put in an array?
I'm drawing a blank on my search for this.
Try writing a program instead, that seems to work better than
21 matches
Mail list logo