in reply to Re^2: Escape variables
in thread Escape variables

I don't know what the rest of your code does.
Code like this should get the input token and strip out the leading and trailing white-space.
#/usr/bin/perl use warnings; use strict; my $username; print "Please enter username to connect to the system:" ; $username=<>; $username =~ s/^\s+//; #trim leading whitespace $username =~ s/\s+$//; #trim trailing whitespace #this includes \r, \n, etc. print $username, "\n";