in reply to Re^2: Regex for splitting a string on a semicolon (conditionally) (use Text::CSV;)
in thread Regex for splitting a string on a semicolon (conditionally)

Ok :) here you go, "Rome: IPGRI" gets seperated from its owner, then its put back
sub breakup { my $filename = $_[0]; my $text = $_[1]; my @stuff = split /;\s?/, $text; my @parts ; while( @stuff ){ if( $stuff[0] =~ m{ ^ \w+ : \s \w+ $ }xms ){ $parts[-1] .= ";".$stuff[0]; } else { push @parts, $stuff[0]; } shift @stuff; } return \@parts; }