How to ignore the single and double dot entries in Perl's readdir?

后端 未结 5 890
甜味超标
甜味超标 2021-01-21 05:04

Following up from here: Perl Imgsize not working in loop? I have another question - how do I not let perl list the single and double dot entries when it reads the files in a dir

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 05:46

    this works and skips the first 2 . and ..

    if($fil !~ m/^\.+/i)
      {
           your stuff here
      }
    

提交回复
热议问题