#!/usr/bin/perl -w use strict; my $email = 'user@company.com'; # this will replace all @'s - add option of (2) to split to replace only one print join( '\@', split( '\@', $email ) ), "\n"; # this will replace only one - add g to replace all $email =~ s/@/\\@/; print $email, "\n";