[NTLUG:Discuss] Perl help
Stuart Johnston
saj at thecommune.net
Thu Feb 7 21:53:50 CST 2008
Rick Renshaw wrote:
> --- Stuart Johnston <saj at thecommune.net> wrote:
>
>> In this case you would want a 'return'. I changed your sub calls around
>> a little too. If you were not in a sub, you would want to use 'next'.
>>
>>
>> sub nextcut {
>> my $path = '/path/to/files/';
>> for $n (31000 .. 31500) {
>> if (! -e "$path/$n.wav" ) {
>> print "$n.wav\n";
>> return $n;
>> }
>> }
>> }
>
> Next wouldn't do anything useful in a loop at the end like the return is in the above sub. Next
> just skips the rest of the loop and starts the next iteration. I think you meant last, which ends
> the loop.
Yes, yes I did. Thanks for the clarification.
More information about the Discuss
mailing list