Page 1 of 1

Hello by [ Perl ], also print & qw()

Posted: Sun Dec 08, 2024 8:42 pm
by BABYLON
First, we created the first.pl file. We saved it to the Home folder in Ubuntu, and its content was as follows.

Code: Select all

$p = "Ben Perl, inci\n";
print $p;
print "Hello $_!\n" for qw(Hello world baraq web);
The expected output will be as follows. :
Ben Perl, inci
Hello Hello!
Hello world!
Hello baraq!
Hello web!

In the qw() function, each element separated by a space completes the character sequence that comes before it by repeating it. "\n" is the escape string used to enter a new line.


HELLO PERL