John W. Krahn wrote: > Mike Blezien wrote: > > > > 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.... > > $ cat test.txt > Animations > Backgrounds > Buttons > Clip_Art > Dividers-Bars > Flash > Fonts > Icons > Interfaces > Member_Tools > Names > Photos > Presentations > Screen_Savers > Templates > Textures > Wallpaper > $ perl -pe'++$a%3?y/\n/ /:s/$/<P>/' test.txt > Animations Backgrounds Buttons<P> > Clip_Art Dividers-Bars Flash<P> > Fonts Icons Interfaces<P> > Member_Tools Names Photos<P> > Presentations Screen_Savers Templates<P>
You really don't like whitespace do you John :-) You're missing Textures Wallpaper<P> which will be in the output file but without the trailing <P>. This is roughly how I started, but had to add to it to print that trailing paragraph. In the process, by the way, I discovered that: ($test += 1) %= 3; works fine, while (++$test) %= 3; doesn't, which must mean that ++$test returns the value of the variable rather than the variable itself. I could understand this with $test++, but there's no reason that I can think of to make the pre-increment work this way. Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]