Hello lina,
On Mon, 23 Apr 2012 23:45:03 +0800
lina <[email protected]> wrote:
> Hi,
>
> suppose I wish to print 20 *
>
> seems
>
> print "*{20}" not work.
>
Use the "x" operator (the repeat operator):
shlomif@telaviv1:~$ cat Test.pl
#!/usr/bin/perl
use strict;
use warnings;
print +('*' x 20), "\n";
shlomif@telaviv1:~$ perl Test.pl
********************
shlomif@telaviv1:~$
Note that "x" behaves differently if the left argument is parenthesised and if
it is not. The first is list repetition and the second is string repetition.
For more information, see:
* http://perldoc.perl.org/perlop.html#Multiplicative-Operators
* http://perl-begin.org/tutorials/perl-for-newbies/part1/#page--arrays--x--PAGE
Regards,
Shlomi Fish
> Thanks ahead for your sugestions,
>
> Best regards,
>
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
What Makes Software Apps High Quality - http://shlom.in/sw-quality
The worst way to waste your time is to never waste it.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/