Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Simpler Section Numbers

by chip (Curate)
on Jul 28, 2000 at 22:34 UTC ( #24963=note: print w/replies, xml ) Need Help??

in reply to RE: RE: Re: Sorting on Section Numbers
in thread Sorting on Section Numbers

You simplified it a lot by dropping $maxdigs.

It's a fair cop, but society's to blame.

I appreciate your final no-hash sprintf approach, but modifying temp values in a grep gives me the screaming heebie-jeebies, you know what I mean? I'd much rather use map for that sort of thing. But I can't argue with the fact that it works.... And my Rule #0 is, ``Anything that works is better than anything that doesn't.''

    -- Chip Salzenberg, Free-Floating Agent of Chaos

PS: Thanks for the welcome. This is a neat site.

Replies are listed 'Best First'.
RE: Simpler Section Numbers
by tye (Sage) on Jul 28, 2000 at 23:32 UTC

    Actually I wrote it as map first and, of course, it didn't work because s// doesn't return the modified string. Breaking the unwritten rule of grep seemed slicker than:

    map {s/.../.../ge; $_}
    which still hides side-effects inside map or:
    map {(my $x= $_)=~s/.../.../ge; $x}
    which just, well, isn't slick. :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://24963]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-06-19 21:59 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (115 votes). Check out past polls.