Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: A problem with using the split command

by Paladin (Priest)
on Apr 30, 2004 at 20:10 UTC ( #349502=note: print w/ replies, xml ) Need Help??


in reply to A problem with using the split command

split actually takes a m// for it's first argument, not just a string. Try:

foreach my $pwd (split(/\\/,'\foo\foo1\foo2')) {
The reason it was failing with \\ was that in a string, the '\\' turns into a literal \ after interpolation. That single \ is then passed to the regex engine as the RE, which is invalid as \ is special in a RE.


Comment on Re: A problem with using the split command
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2015-07-06 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (74 votes), past polls