Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Triangle Golf

by jmcnamara (Monsignor)
on Apr 24, 2001 at 17:14 UTC ( #75037=note: print w/replies, xml ) Need Help??


in reply to Triangle Golf


This was attempt to see if using format() would be shorter. It wasn't. It does use some of Perl's dustier artifacts however:
#!/usr/bin/perl -wall -00n use strict; END{ @_=shift@F; while(@F){ $_=shift @F; $_.=' '.shift@F while(length$_<=length$_[-1]&&@F); push@_,$_ } formline(('@'.('|'x80)."\n")x@_,@_); print $^A }


Update: Using MeowChow's regex this can be reduced to 89 chars + 6 command line switches. I'm not proud of this:
#!/usr/bin/perl -w -00nal use strict; END{ $_="@F "; @F=1; formline'@'.('|'x80)."\n",$&and@F=length$&while/.{1,@F}.*? /g; print$^A }


John.
--

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://75037]
help
Chatterbox?
[ambrus]: the directory structure may be 1, 2, or 3 deep, it may have spaces in the filename or not, it has dates in various format, different keywords for the same meanings, and the dates and other keywords are assembled in various ways.
[Discipulus]: no ambrus by specification i mean for example license per core instead of per socket, so fields are different

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2017-03-29 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (351 votes). Check out past polls.