Not sure I'm understanding the context, but #!/usr/bin/perl use strict; my $kw = 'abc\ndef'; print "[$kw]"; print "\n-------\n"; my $kx = "abc\ndef"; print "[$kx]"; I've added brackets for clarity. Walter