[Cascavel-pm] Res: Verificar tamanho arquivo

Nelson Ferraz nferraz em gmail.com
Quinta Maio 20 07:09:05 PDT 2010


2010/5/20 Patty Silva <ptfzs em yahoo.com.br>:
> Eu achava que o comando:opendir(DIR, $dir) ........
> Nao precisaria do diretorio :)

perldoc -f readdir

      readdir DIRHANDLE
              Returns the next directory entry for a directory opened by
"opendir".  If used in list context, returns all the rest of the entries
              in the directory.  If there are no more entries, returns an
undefined value in scalar context or a null list in list context.

              *If you’re planning to filetest the return values out of a
"readdir", you’d better prepend the directory in question.*  Otherwise,
              because we didn’t "chdir" there, it would have been testing
the wrong file.

                  opendir(DIR, $some_dir) ││ die "can’t opendir $some_dir:
$!";
                  @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
                  closedir DIR;
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/cascavel-pm/attachments/20100520/52ea242c/attachment.html>


Mais detalhes sobre a lista de discussão Cascavel-pm