
rovf
Veteran
Dec 29, 2010, 4:00 AM
Post #4 of 4
(2440 views)
|
|
Re: [iphone] How to check for an empty array in perl?
[In reply to]
|
Can't Post
|
|
I don't know what the 'next' is doing in your code, since you are not in a loop.
I want to push $newfile to another array @newfiles only if the array is empty This could be done by
push @newfiles,$newfile unless @array; but you also say:
and the instructions after the push instruction should not be executed. In this case, I think an 'if' is the cleanest solution:
if(@array) { ..... } else { push @newfiles,$newfile; }
|