in reply to Re: Minimizing the amount of place holders on long identical regex
in thread Minimizing the amount of place holders on long identical regex

Hello Eily,

Thank you for your time and effort. The solution is working but in my case I can not use array as an output. This is because I can not use join to put the array in a string. I am using place holders as a solution to this problem.

#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; my $sample = "041424344454647484940414"; $sample =~ /([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([ +0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])( +[0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/; # 24 times the same patte +rn print "$1$3$5$7$9$11$13$15$17$19$21$23\n"; my $new = "041424344454647484940414"; $new =~ /(\d).?/g; print "$1$3$5$7$9$11$13$15$17$19$21$23\n"; my @array = $new =~ /(\d).?/g; print Dumper \@array; __END__ $ perl test.pl 012345678901 Use of uninitialized value $3 in concatenation (.) or string at test.p +l line 12. Use of uninitialized value $5 in concatenation (.) or string at test.p +l line 12. Use of uninitialized value $7 in concatenation (.) or string at test.p +l line 12. Use of uninitialized value $9 in concatenation (.) or string at test.p +l line 12. Use of uninitialized value $11 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $13 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $15 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $17 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $19 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $21 in concatenation (.) or string at test. +pl line 12. Use of uninitialized value $23 in concatenation (.) or string at test. +pl line 12. 0 $VAR1 = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1' ];

Thanks again for your time and effort.

Seeking for Perl wisdom...on the process of learning...not there...yet!