PageRenderTime 41ms CodeModel.GetById 35ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

Unknown | 54 lines | 45 code | 9 blank | 0 comment | 0 complexity | c740780e717bb6b96dd6878afb0a284f MD5 | raw file
 2From: tchrist@convex.COM (Tom Christiansen)
 3Newsgroups: comp.lang.perl
 4Subject: Re: The problems of Perl (Re: Question (silly?))
 5Message-ID: <>
 6Date: 17 Jan 92 05:31:15 GMT
 7References: <> <> <>
 8Sender: (news access account)
 9Reply-To: tchrist@convex.COM (Tom Christiansen)
10Organization: CONVEX Realtime Development, Colorado Springs, CO
11Lines: 83
14From the keyboard of (Felix Lee):
15:And Perl is definitely awkward with data types.  I haven't yet found a
16:pleasant way of shoving non-trivial data types into Perl's grammar.
18Yes, it's pretty aweful at that, alright.  Sometimes I write perl programs
19that need them, and sometimes it just takes a little creativity.  But
20sometimes it's not worth it.  I actually wrote a C program the other day
21(gasp) because I didn't want to deal with a game matrix with six links per node.
23:Here's a very simple problem that's tricky to express in Perl: process
24:the output of "du" to produce output that's indented to reflect the
25:tree structure, and with each subtree sorted by size.  Something like:
26:    434 /etc
27:      |     344 .
28:      |      50 install
29:      |      35 uucp
30:      |       3 nserve
31:      |       |       2 .
32:      |       |       1
33:      |       1 sm
34:      |       1 sm.bak
36At first I thought I could just keep one local list around
37at once, but this seems inherently recursive.  Which means 
38I need an real recursive data structure.  Maybe you could
39do it with one of the %assoc arrays Larry uses in the begat
40programs, but I broke down and got dirty.  I think the hardest
41part was matching Felix's desired output exactly.  It's not 
42blazingly fast: I should probably inline the &childof routine,
43but it *was* faster to write than I could have written the 
44equivalent C program.
50"GUIs normally make it simple to accomplish simple actions and impossible
51to accomplish complex actions."   --Doug Gwyn  (22/Jun/91 in comp.unix.wizards)
53     Tom Christiansen       convex!tchrist