Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Escape variables

by Marshall (Canon)
on Jan 09, 2016 at 11:18 UTC ( [id://1152389]=note: print w/replies, xml ) Need Help??


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";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1152389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found