Input from Standard Input
chomp($line = <STDIN>);
# read the next line and chomp it
Since the line-input operator will return undef
when you reach end-of-file, this is handy for dropping out of loops:
while (defined($line = <STDIN>)) {
print
… Read the rest