chomp



examples/scalars/read_from_stdin_chomp.pl
#!/usr/bin/perl
use strict;
use warnings;

print "Enter your name, please: ";
my $name = <STDIN>;
chomp $name;
print "Hello $name - how are you ?\n";

chomp will remove the new line "\n" character from the end of the string if there was one.