How do I make the following line not ignore zero-length strings?? @otherchoices = split(/\|/, $choices); I have a $choices...

How It Works

Get an answer in three easy steps. Here's how it works...

Ask Your Question

1. Ask Your Question

Enter your programming question at the top of this page and click Get An Answer.

Pick Your Priority

2. Pick Your Priority

Tell us how quickly you want your programming question answered.

Get An Answer

3. Get An Answer

Connect with your programmer via online chat or telephone call.

Answer

Customer
How do I make the following line not ignore zero-length strings?? @otherchoices = split(/\|/, $choices); I have a $choices= '|ASDF|ERTY|SDFGH' and I need: "", "ASDF", "ERTY" and "SDFGH" The Python split does what I want, but that isn't an option, unless you know if perl can call python. How would I do that? Putting a space isn't an option either, it needs to be a zero-length string. Where can I go to find information? Thank you for any assistance you can offer.
Posted
shane
Programmer
Mayeb I didnt understand your question completely, but it looks like you need the tr function, not the split. Try: $choices =~ tr/\|/,/s; I am not sure if you will need to escape the comma though. Hope it helps
Posted

quoteTestimonialsquote

About ExpertHelp

ExpertHelp is changing the way you connect with service professionals.

Whether you have a quick question while preparing your taxes, troubleshooting a computer problem, or need to hire an attorney, ExpertHelp is the most convenient and affordable way to connect with the right service professional to get the job done.

ExpertHelp has been in business since 2011, is an A+ Rated Better Business Bureau accredited member, and offers a 100% satisfaction guarantee on every question you ask!

More Programming Questions...

Ask Your Programming Question & Get An Answer Now!