473,378 Members | 1,142 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Modify a Substitution Line and a Split function

36
I have the following two lines of code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. $line =~ s/(^\s+|\s+$)//g;
  3. my($account, $warning) = split(/\s+/, $line);
  4.  
I believe this is removing all the white space from the beginning and the end of each line of data in the file. Then it is splitting the line into two separate variables based on white space found on each line.
I want to modify it to that the Split function will split the line up into two separate variables based on a comma, and not white space. I have no clue what to modify in order to make that happen.
Any suggestions, would be helpful! Perl is new to me, and I just have not managed to get my head wrapped around all the substitution formats and rules.
Thanks in advanced!
Apr 23 '10 #1
1 1610
RonB
589 Expert Mod 512MB
Please read the documentation for the split function.

perldoc -f split
Apr 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: susanlimsg lim | last post by:
I have tried to resolved this problem but I dunno how to resolved it can anyone help me?? It cannot be successfully displayed at the mozilla environment // written by Tan Ling Wee on 2 Dec...
18
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
0
by: richardkreidl | last post by:
I have the following hash script that I use to compare two text files. 'Class Public Class FileComparison Public Class FileComparisonException Public Enum ExceptionType U 'Unknown A 'Add...
7
by: Jchick | last post by:
Firstly, I am a noobie with some exposure to VB.net Secondly, I am tasked with trying to do the following: I have a CSV file that I'd like to have a vb.net program make a change to: Here is...
4
by: News | last post by:
Hi Everyone, The attached code creates client connections to websphere queue managers and then processes an inquiry against them. The program functions when it gets options from the command...
2
by: Richard Steele | last post by:
ASP.net Framework 2 IIS 6 Win 2003 Is it possible to substitute the & (ampersand) in a querystring for antother value i.e test.com?param1=test;param2=notest instead of &(ampersand) can i...
11
by: mailforpr | last post by:
Is this design well-formed? It contradicts the LSP and Design by contract anyhow. LSP tells us that "In class hierarchies, it should be possible to treat a specialized object as if it were a base...
3
by: Skip | last post by:
OK, I'm a novice in JS but have lots of coding experience. I am trying to accomplish something that would seem somewhat simple - BUT IT'S NOT. I have a basic window that calls another window...
5
by: TJ | last post by:
I'd like to know how the preprocessor treats curly braces, as compared to how it treats parentheses. What happens if I pass this: { a_function( arg1, arg2, arg3 ) } as an argument to a...
4
by: andersond | last post by:
I have previously asked a question with the same title line but my situation and purpsse are different this time. I mean to be creating a function to go back over a form, identify blank required...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.