in reply to Reading mail ids from text file

Looks like a job for the dynamic trio, print-join-map.
my $file = "pp.txt" ; open (FH ,$file) || die ("could not openfile"); print join(" ", map { chomp; s/\+s$//; s/\@/\\@/; $_ } <FH> ),"\n"; close (FH);