bacon!!;eggs #### while (<>) { chomp; s/\x{00}/\x{00}0/g; s/!!/\x{00}1/g; s/!;/\x{00}2/g; my @a = split /;/; for (@a) { s/\x{00}2/;/g; s/\x{00}1/!/g; s/\x{00}0/\x{00}/g; } ... }