foreach my $word ( split /,\s*/, $string ) { # do stuff with $word here }