while() { chomp; ($key,$data) = split("=="); $links{$key} = $data; } #### $content = join("",); # this is better replaced with arturos method # of reading in whole file foreach $k (keys %links) { $content =~ s/$k/$links{$k}/gm; }