in reply to Re: How do I read this line of code?
in thread How do I read this line of code?
Thanks for your answer, this helps a lot.
Now, what if there is no shift:
$buff .= $_ for "\n", ' ' x ( $level - 1), @pre_push;I would expect every element in @pre_push to have a newline and spaces in front of it, but when I test it, using the following code, I see that the newline and spaces are only added once.
my @pre_push; my $level = 2; my $buff = ''; push (@pre_push, "test"); push (@pre_push, "test2"); for my $string ("\n", ' ' x ( $level - 1 ), @pre_push) { $buff = $buff . $string; } print $buff;
Output:
testtest2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How do I read this line of code?
by GrandFather (Saint) on Sep 29, 2011 at 09:46 UTC | |
|
Re^3: How do I read this line of code?
by choroba (Cardinal) on Sep 29, 2011 at 09:46 UTC |