Sunday, July 17, 2011

To repeat words in perl

This makes use of the repeatation operator "x" to repeat the words

Content of the perl file:

$dd="hello";
$ss="$dd "x 5;
print $ss;

Output:

G:\perl_programs>perl perl_repeat.pl
hello hello hello hello hello
G:\perl_programs>

No comments:

Post a Comment