- or download this
$line =~ s/\([^)]+\)//g;
my @results = split /,/, $line;
print "$_: $results[$_]\n" for 0 .. $#results;
- or download this
$string = "abc,def;ghi";
$string =~ /^([^,]+),([^;]+);(.+)$/;
- or download this
# Capture a 'non-comma/non-open-paren' string, optionally
# followed by parens (not captured), optionally followed by a comma
...
my @out = $line =~ /^$re$/;
print "$_: $out[$_]\n" for 0 .. $#out;