Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Remove digits from a string and add timestamp to the result

by ww (Bishop)
on Jan 02, 2013 at 13:31 UTC ( #1011273=note: print w/replies, xml ) Need Help??

in reply to Remove digits from a string and add timestamp to the result

I'm with johngg on this.

WHY are you doing something that looks like makework? If you need to sort customers by alpha (the only plausible reason for your spec that I've dreamed up), you can do that with the datestamp in its initial position. This 4th line of this code is lifted almost verbatim from the doc for sort

my @old = qw(20120301Customer100 20120402Alsocust200 20130102Nothercu3 +00); my (@new, $item); @new = sort { substr($a, 8) cmp substr($b, 8) } @old; for $item(@new) { say $item; }

See perldoc -f sort and perldoc -f substr. But for best results (and as has been asked before) tell us what you really want to do and WHY you think you need to do that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011273]
[erix]: in this context, one learns all kinds of interesting psychological excuse-jargon: not just 'alternative facts'; how about 'gapped knowledge' ? :)
[erix]: which still manages to sound more or less positive
[Corion]: Huh. I wasn't aware that you cannot segregate Python 2 and Python 3 modules... Hopefully Perl 6 module use C6AN and thus avoid the problem...
[hippo]: I very much hope so.
[moritz]: there are already some (very few) Perl 6 modules on CPAN, but in a way that the p5 indexer avoids them
[hippo]: It's confusing enough to have the Perl6:: namespace which isn't for Perl6 but for features from that ported into Perl.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2017-01-24 09:19 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.