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

Re: How can I reduce this with a REGEX?

by hdb (Monsignor)
on Mar 14, 2014 at 17:48 UTC ( #1078370=note: print w/replies, xml ) Need Help??


in reply to How can I reduce this with a REGEX?

Also using a hash but in a different way:

use strict; use warnings; my @strings = qw( 12-12 12-12-12 12-13-12-13 12-12-13-13 12-13-13-14 ) +; for (@strings) { my %hash; s/(\-?)(\d\d)/ $hash{$2}++ ? '' : $1.$2 /ge; print "$_\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078370]
help
Chatterbox?
[Corion]: Hehe - $work is a place where we have lots of (money) accounts, and lots of journals where every transaction is recorded. But our HR system where the accounts of hours worked and vacation days taken are stored, there is no real account of who changed ...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2018-01-23 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (248 votes). Check out past polls.

    Notices?