Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Quick RegExp question

by graff (Chancellor)
on Mar 05, 2008 at 02:14 UTC ( #672062=note: print w/replies, xml ) Need Help??

in reply to Quick RegExp question

As Tanktalus said, you want m/\s/.

But watch out. If a space in the file name can cause a given script to crash, there are other bad things that can also turn up in file names (also as a result of "pilot error", but hey, it happens, as we all know), and these can do more damage than just crashing your script.

(I've seen some MS-Windows users put ampersands in file names. Imagine the fun you can have with that in a unix shell environment.)

My point is: If the script crashes because there is a space in the file name, there is actually a deeper problem with the script, in terms of what it is doing with the variable(s) that hold the file name(s) -- e.g. passing the variable as part of a quoted string to a shell command (in back-ticks or in a "system()" call) -- and it would be very prudent to fix that (using quotemeta, multi-arg system call, totally different logic, etc). Now. Before the next "unexpected" mistake turns up in a file name.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://672062]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2022-08-15 19:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found