in reply to Re: Creating filenames
in thread Creating filenames

Thanks. This works, but @ww makes a good point that I should count the number of words, stick it in a variable, then the loop doesn't have to go around 12 times. This seems to work:
@words = split (/ /, $titleclean); $numwords+=@words; $filename = $year."-".$mon; for ($i=0; $i<$numwords; $i++) { $filename = "$year-$mon-" . join("-",@words) . ".html"; }
Look okay?

Replies are listed 'Best First'.
Re^3: Creating filenames
by ww (Archbishop) on Apr 02, 2012 at 20:23 UTC
    No.

    roboticus way goes around only as many times as there are words in the title.

      Thanks. You're right. roboticus's way works. I misunderstood.