[SP-pm] Listagem de Arquivos

thiagoglauco at ticursos.net thiagoglauco at ticursos.net
Fri Aug 20 07:47:22 PDT 2010


Pode me explicar isso:

my $produrar = 'ALLTASKS';
my @arquivos = grep(/^$produrar/, em thefiles);

Acho que esta no loop... O codigo modificado abaixo gerou apenas uma  
saida no meu sistema!!!

  use strict;
   2 use warnings;
   3
   4 my $diretorio=".";
   5 opendir(IMD, $diretorio) || die("Cannot open directory");
   6 my @thefiles= readdir(IMD);
   7 closedir(IMD);
   8
   9 my $produrar = 'teste.c';
  10
  11 open(ARQ1,">Lista.html");
  12 print ARQ1 "<html><head><title>Listagem de arquivos</title></head>\n";
  13 print ARQ1 "<body><h1>Listagem de Arquivos\n";
  14
  15 my @arquivos;
  16
  17 foreach my $f (@thefiles)
  18 {
  19  unless ( ($f eq ".") || ($f eq "..") )
  20  {
  21    @arquivos = grep(/^$produrar/, em thefiles);
  22 }
  23 }
  use strict;
   2 use warnings;
   3
   4 my $diretorio=".";
   5 opendir(IMD, $diretorio) || die("Cannot open directory");
   6 my @thefiles= readdir(IMD);
   7 closedir(IMD);
   8
   9 my $produrar = 'teste.c';
  10
  11 open(ARQ1,">Lista.html");
  12 print ARQ1 "<html><head><title>Listagem de arquivos</title></head>\n";
  13 print ARQ1 "<body><h1>Listagem de Arquivos\n";
  14
  15 my @arquivos;
  16
  17 foreach my $f (@thefiles)
  18 {
  19  unless ( ($f eq ".") || ($f eq "..") )
  20  {
  21    @arquivos = grep(/^$produrar/, em thefiles);
  22 }
  23 }
24
  25 print "@arquivos";
  26 foreach my $Nome(@arquivos)
  27  {
  28   print ARQ1 "<table><td><a
  29 href=".$diretorio."/".$Nome.">".$Nome."</a></td></table>";
  30  }
  31
  32
  33
  34 print ARQ1 "</body></html>\n";

gerou apenas uma saida no meu sistema

Quoting Ailton Zacarias <ailtonzsilva em gmail.com>:

> Bom dia Amigos
>
> Gostaria de saber onde estou errando ... pq na listagem de arquivos ele
> duplica os nomes de arquivos??? Obrigado!
>
>
> use strict;
> use warnings;
>
> my $diretorio="C:/Tmp/e-Mails/ENVIADOS";
> opendir(IMD, $diretorio) || die("Cannot open directory");
> my @thefiles= readdir(IMD);
> closedir(IMD);
>
> my $produrar = 'ALLTASKS';
>
> open(ARQ1,">Lista.html");
> print ARQ1 "<html><head><title>Listagem de arquivos</title></head>\n";
> print ARQ1 "<body><h1>Listagem de Arquivos\n";
>
>
> foreach my $f (@thefiles)
> {
>  unless ( ($f eq ".") || ($f eq "..") )
>  {
>   my @arquivos = grep(/^$produrar/, em thefiles);
    }
}
> foreach my $Nome(@arquivos)
>  {
>   print ARQ1 "<table><td><a
> href=".$diretorio."/".$Nome.">".$Nome."</a></td></table>";
>  }
>  }
> }
>
> print ARQ1 "</body></html>\n";
> close(ARQ1);
>
>
>
>
> --
> Ailton Zacarias
> F4 Computer ? Soluções em Tecnologia da Informação
> Tel: 55 +11 4062-0180 (Ailton)
> Cel: 55 +11 8405-8334
> MSN: ailton em f4computer.com
> Skype: ailton.zacarias
> http://www.f4computer.com
>





More information about the SaoPaulo-pm mailing list