Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Does split not work with a pipe?

by jethro (Monsignor)
on Nov 09, 2012 at 17:16 UTC ( #1003187=note: print w/replies, xml ) Need Help??


in reply to [SOLVED] Does split not work with a pipe?

The first parameter of split is a regex pattern, not a string. Now the regex, lets spell it m/|/, matches the empty string. If you read the perldoc of split, you will find the following sentence:

A pattern matching the empty string (not to be confused with an empty pattern "//", which is just one member of the set of patterns matching the epmty string), splits EXPR into individual characters.

PS: Please use strict; use warnings;.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003187]
help
Chatterbox?
[shmem]: thanks vrk - but I'll rather have a plate of "silly con charme"
Lady_Aleena is trying to explain perl regexen to people right now and explaining how variables expand in regexen.
[Lady_Aleena]: The people I'm talking with think /$var/ looks weird with some saying it shouldn't work.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-04-28 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (520 votes). Check out past polls.