rastoboy has asked for the wisdom of the Perl Monks concerning the following question:
I know this is a silly question, but it's really bugging me. I need to print a bunch of -'s of an arbitrary computed length, such as:
-------
or maybe:
-----------------
At the moment I compute the length needed and do:
I could have sworn I've read a simple way to simply say "print X this many times". It's just not very elegent or "perlish" seeming and I'd appreciate any feedback you care to give!while ($length) { $separator .= '-'; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Print a string X times?
by almut (Canon) on Aug 03, 2010 at 23:53 UTC | |
Re: Print a string X times?
by toolic (Bishop) on Aug 04, 2010 at 00:02 UTC | |
Re: Print a string X times?
by BrowserUk (Patriarch) on Aug 03, 2010 at 23:53 UTC | |
by rastoboy (Monk) on Aug 04, 2010 at 00:01 UTC | |
Re: Print a string X times?
by cdarke (Prior) on Aug 04, 2010 at 06:01 UTC | |
by targetsmart (Curate) on Aug 04, 2010 at 07:45 UTC | |
by pid (Monk) on Aug 04, 2010 at 08:27 UTC | |
by GrandFather (Saint) on Aug 04, 2010 at 09:35 UTC | |
by Skeeve (Parson) on Aug 04, 2010 at 07:52 UTC | |
Re: Print a string X times?
by ikegami (Patriarch) on Aug 04, 2010 at 16:03 UTC | |
by Skeeve (Parson) on Aug 05, 2010 at 05:44 UTC |
Back to
Seekers of Perl Wisdom