17 lines
375 B
Perl
17 lines
375 B
Perl
|
#!usr/bin/perl
|
||
|
|
||
|
use warnings;
|
||
|
use strict;
|
||
|
|
||
|
print "Input something and we'll print it: ";
|
||
|
my $string = <STDIN>;
|
||
|
|
||
|
print "\nOur input ( $string ) contains a newline. Remove it:\n";
|
||
|
chop( $string );
|
||
|
|
||
|
print "\nThis is more like it: '$string' without the newline.\n";
|
||
|
|
||
|
my $character = chop( $string );
|
||
|
print "\nWe removed $character; now it is '$string.'\n";
|
||
|
|
||
|
|