in reply to splitting lines a number of times

There is no need for regex. It only takes a tr///d and a simple split():

while ( my $line = <DATA> ) { chomp $line; # backup of line, in case we need original version later my $line_copy = $line; # transliterate ',' into ';' remove '(', ')' and space(0x20) $line =~ tr/,() /;/d; # split at ';' my ( $first, $second, @rest ) = split /;/, $line; # do your work }

Replies are listed 'Best First'.
Re^2: splitting lines a number of times
by Anonymous Monk on Apr 06, 2009 at 09:16 UTC
    Excellent, works exactly how I wanted it to and makes the code nice and self explanatory, also got me to read about transliteration, so thanks for that and for all the other answers!