"Erik Riggenbach" <[EMAIL PROTECTED]> writes:
> so here's my code and the problem is that it doesn't a) ignore the . and ..
> dirs b) it doesn't acknowledge some dirs as being dirs. With some examples
> where there are lots of files and Dirs it does print the '-' before the
> dirs. Needless to say, if the recursion is not commented out it's an
> infinite loop as it processes the . dir over and over. Any help would be
> much appreciated.
> Thanks,
> Erik
>
> readmydirs('/mp3');
>
> sub readmydirs{
> opendir(DIR, $_[0]);
> my @lists = readdir DIR;
> foreach my $element (@lists){
Maybe you need an explicit match here:
> if(-d $element and !/^\.{1,2}$/){
if(-d $element and $element !~ /^\.{1,2}$/){
(untested..)
> print "-";
> print $element;
> print "\n";
> # readmydirs($element);
> }
> else{
> print $element;
> print "\n";
> }
> }
> }
> ---
> Everyday we're told we live in the greatest country on earth and it's always
> stated as an un deniable fact: Leos are born between July 23 and August 22,
> fitted queen-size sheets measure 60x80 inches, and America is the greatest
> country on earth. Having grown up with this in our ears, it's startling to
> realize that other countries have nationalistic slogans too, none of which
> are 'We're number two!
> - Dave Sedaris, "Me Talk Pretty One Day "
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]