Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: Quick RegExp question by graff
in thread Quick RegExp question by wruehl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2022-08-15 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?