Solved

How to split using  Perl?

Posted on 2004-08-25
1
258 Views
Last Modified: 2010-04-17
I have the following query on spliting using perl:

sample input :

1234,3,"testing , sample"$

if i use: @field = split /,/;
the outoput will be :
field[0] = 1234
field[1] = 3
field [2] = testing
however, i need the whole string "testing , sample"  to store in the field [2]

expected output:
1234 ,3 ,testing sample

Could anyone advise how to split the record to get the expected output?
0
Comment
Question by:jescho
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 11899854
use Text::ParseWords;
@field = quotewords(",", 0, $text);
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now