in reply to (golf)String Concats or: playing with substr()

I wanted there to be a solution using write, but it won't pad out trailing whitespace for you. It could be done using right-justification, but I assume that's not what you want to do. On the other hand, if you're looking at multiple columns, it has merits (you can get around the padding problem, if you want to use read, but then you might as well use printf).

format FILE = @<<<<<<<<<@<<<<<<<<@<<<<<<<<< @foo . for my $line (@LoL) { @foo = @$line; write FILE; }

(The hacks to force a constant record length that I've come up with while writing this are either to right-justify the last field or put in a dummy field at the end with a useless character in it, btw--I'm sure there are others.)



If God had meant us to fly, he would *never* have give us the railroads.
    --Michael Flanders

Replies are listed 'Best First'.
Re: Re: (golf)String Concats or: playing with substr()
by one4k4 (Hermit) on May 19, 2001 at 02:56 UTC
    See, this is was was in on the tip of my tongue, but I couldnt think of the syntax, nor even was it was called. Sigh. I'll give that a shot though. TMTOWTDI, of course, and maybe I should benchmark the different ways. Heck, I'd learn benchmark. ;)

    _14k4 - webmaster@poorheart.com (www.poorheart.com)