PERL - Chomp
Let's take another look at our agencolor.pl script. This script asked for two user inputs and returned an unformatted string and our variables as a result on the last line.agencolor.pl:
#! usr/bin/perl print "How old are you?"; $age = <>; print "What is your favorite color?"; $color = <>; print "You are $age, and your favorite color is $color.";
agencolor2.pl:
#! usr/bin/perl print "How old are you?"; chomp ($age = <>); print "What is your favorite color?"; chomp ($color = <>); print "You are $age, and your favorite color is $color.";
0 comments:
Post a Comment