in reply to Re: Get file names
in thread Get file names
Yes.. i´ve already use that..!! Is this the best way or the most efficent way? Or is preferably to use modules instead of perl built in commands?
I´ve made this code:
use strict; use warnings; my $path="c:\\teste"; sub procura_ficheiros{ ($path)=@_; opendir(DIR, $path) ||die "$!"; my @files=grep{/\.c$/} readdir(DIR); close (DIR); return @files; } my @res=procura_ficheiros($path); foreach my $fich (@res){ my $final=$path."\\".$fich; print "Ficheiro: $path\\$fich\n"; print "Final: $final\n"; }
It works.. but is it the most efficcient??
Thank you once againNuno
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Get file names
by Preceptor (Deacon) on Aug 26, 2003 at 19:11 UTC | |
|
Re: Re: Re: Get file names
by tcf22 (Priest) on Aug 26, 2003 at 18:11 UTC |