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"; }
|
---|
In Section
Seekers of Perl Wisdom