Thursday 15 July 2010

perl - How do I find all lib directories under a Windows path? -


I get "no file found" when I run the script:

  File :: Use the basinum; My @dirs = grep {fileparse ($ _) = ~ / ^ [L | L] ib /} split / \ n /, dir e: \\ / ad / b / s; Print @ dirs;  

This is my real code, I will send grep to the full drive lib or Lib names and directories Trying the subdirectory.

If you are using code, then the only thing I can think of can be Is that an external dir.exe does not understand command line options for the cmd.exe underlying dir on your path. For example, with Sigwin's directories on my way, I can not access

 dir: / ad / b / s: no such file or directory 

You should show you the Precise output if you want people to enable help you more effectively.

To ensure that this does not happen, use it:

  Use strict; Use warnings; File :: Use the basinum; My @dirs = grep {fileparse ($ _) = ~ / ^ [LL] ib /} divided / \ n /, `cmd.exe / c dir e: \\ / ad / b / s`; Print "$ _ \ n" for print;  

Focus on backtax `` `. Also note the improvement in the pattern you are using.


No comments:

Post a Comment