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!

In reply to Re^2: Minimizing the amount of place holders on long identical regex by thanos1983
in thread Minimizing the amount of place holders on long identical regex by thanos1983

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.