while() { my $str = $_; $str =~ s/!,!/!:::!/g; my @parts = split(':::', $str); print join("==>", @parts), "\n"; }