in reply to [untitled node, ID 202198]

Why not use a hash?
#!/usr/bin/perl -w use strict; my $html = <<END_OF_HTML; Hello! oX World! <;<;<;<; Hi! Samn! (~) END_OF_HTML my %emotes = map {split /#####|\n/} <DATA>; for my $entry(keys %emotes) { $html =~ s!\Q$entry\E!<img src="$emotes{$entry}.gif">!g; } print $html; __DATA__ oX#####skullandbones <;#####pie (o)#####goatse (~)#####ninja
Note that im removing the trailing newline in the split operation, which is -ew- ugly.