By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,177 Members | 976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,177 IT Pros & Developers. It's quick & easy.

Modify a Substitution Line and a Split function

P: 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
Share this Question
Share on Google+
1 Reply


Expert Mod 100+
P: 589
Please read the documentation for the split function.

perldoc -f split
Apr 23 '10 #2

Post your reply

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