Variable interpolation - User Input and Output - chomp - video
User Input and Output
Variable interpolation
examples/perl/variable_interpolation.pl
#!/usr/bin/perl use strict; use warnings; my $name = "Foo"; print "Hello ", $name, " - how are you ?\n"; print "Hello $name - how are you ?\n";
More about strings and interpolation.
Read from the keyboard
examples/perl/read_from_stdin.pl
#!/usr/bin/perl use strict; use warnings; print "Enter your name, please: "; my $name = <STDIN>; print "Hello $name - how are you ?\n";
chomp
examples/perl/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";
Published on 2015-02-21
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post