Mike Blezien wrote:
> Hello all,
>
> I know this probably very simple and I've overlooked the obvious here, but I
> have a flat file containing categories:
[snip data]
>
> Now what I am trying to do, is to read the file, the re-format the output to
> have every 3 categories on one line, separated by a space, then each line end
> with a <P>, IE:
>
> Animations Backgrounds Buttons<P>
> Clip_Art Dividers-Bars Flash<P>
> ... etc....
>
> Any help would much appreciated...

Hi Mike.

I couldn't resist this one!

    do {
        my @line;
        push @line, scalar <DATA> for 1..3;
        @line = grep { chomp, 1 if defined } @line;
        print "@line<p>\n";
    } until eof;

    __DATA__
    Animations
    Backgrounds
    Buttons
    Clip_Art
    Dividers-Bars
    Flash
    Fonts
    Icons
    Interfaces
    Member_Tools
    Names
    Photos
    Presentations
    Screen_Savers
    Templates
    Textures
    Wallpaper

output

    Animations Backgrounds Buttons<p>
    Clip_Art Dividers-Bars Flash<p>
    Fonts Icons Interfaces<p>
    Member_Tools Names Photos<p>
    Presentations Screen_Savers Templates<p>
    Textures Wallpaper<p>

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to