Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to split using  Perl?

Posted on 2004-08-25
1
Medium Priority
?
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Starting up a Project

705 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