Modify a Substitution Line and a Split function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brat33
    New Member
    • Jan 2010
    • 36

    Modify a Substitution Line and a Split function

    I have the following two lines of code:
    Code:
           
    $line =~ s/(^\s+|\s+$)//g;
    my($account, $warning) = split(/\s+/, $line);
    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!
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Please read the documentation for the split function.

    perldoc -f split

    Comment

    Working...