Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Function for reading file

by AnomalousMonk (Archbishop)
on Mar 29, 2020 at 01:42 UTC ( [id://11114764]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Function for reading file
in thread Function for reading file

... the word regex \W ...

It's important to understand what you're dealing with. The  \W (that's big-W) character class (see perlrecharclass) matches any character that is not a  \w (little-w) character. The  \w characters are sometimes called "word" characters, but IIRC they originate with the set of characters that are allowed in a C- or Perl-language identifier; that's why  _ (underscore) is included, but  - (hyphen), for instance, is not. So  \W is better described as the anti-word regex!

And I agree with davido's point here that if  [A-Za-z\W] really does the trick for you, then  [^_\d] is more clear, readable, maintainable, and IMHO preferable.

Update: Made "identifier" into a Wikipedia link.


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-20 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found