Hi I have these strings and several other strings in an array.
revised_1.4_1.4-1.05-jan
revised_1.5_1.8-before
revised_1.5_1.8-after
revised_1.5_0.7-mid
deleted&reviewed_0.9-0.8-1.05-jan
deleted&reviewed_1.6_1.6-before
deleted&reviewed_0.5_1.8-after
deleted&uploaded_0.8_1.9-midweek
deleted&uploaded_1.0_1.3-offweek
accessedbeforesecondquarter_0.8._1.6-jan
accessedbeforesecondquarter_0.9_1.7-feb
I need to keep one of the almost similar strings in the array. How can I code to get this array?
revised_1.4_1.4-1.05-jan
deleted&reviewed_0.9-0.8-1.05-jan
deleted&uploaded_0.8_1.9-midweek
accessedbeforesecondquarter_0.8._1.6-jan
Here's my code and it doesn't seem to work fine for me to save the strings into an array.
my %seen;
my @strings = grep !$seen{ substr($_,0,2) }++, @strings;