# BY DR JONATHAN REES #
Don't be too proud.
$sym = "*"; # $sym is the string to be concatenated
Why is that not a parameter?
&concat($l); # calls the sub concat passing the
Don't use "&" when calling a sub. It's old fashioned and if you don't know its meaning (I doubt you do), you probably shouldn't be using it.
print $i; # prints the result
Don't comment *what* your code does, comment *why* it does that.
for ($k = 1 ; $k < $val ; $k++){ $i = $i.$sym; }
C-style for is error prone and a lot of work. Perlish foreach is more efficient and easier. The ".=" operator would have saved you two more non-whitespace characters. Besides that, you should of course have used the "x" operator.
}
And fix your indenting logic.
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
In reply to Re: String concatenation function
by Juerd
in thread String concatenation function
by jonnyr9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |