On May 11, Jason Dusek said:

>How do I get the wanted function in a find call to ignore file names
>with spaces in them? I want to catch all files with the suffii '.pro'
>and .'idl' but some Windows user has put files like 'Foo Bar Har.pro' on
>the system. I am trying:
>
>   sub wanted {
>     if (/\.(pro|idl)$/ && !/\w+\s+\w+/) {
>       ## do some fancy stuff
>     }
>   }
>
>but the evil files with spaces in their names seem to be slipping
>through the regexp. Any suggestions?

I would just do:

  if (/\.(pro|idl)$/ and !/\s/) { ... }

You can't be sure how the spaces are going to appear, so just make sure
there aren't any.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to