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

This is not much more elegant but it does save long lines in your source.

#!/usr/bin/env perl use strict; use warnings; my $sample = "041424344454647484940414"; my $re = '([0-9])' x 24; $sample =~ /$re/; print "$1$3$5$7$9$11$13$15$17$19$21$23\n";
  • Comment on Re: Minimizing the amount of place holders on long identical regex
  • Download Code

Replies are listed 'Best First'.
Re^2: Minimizing the amount of place holders on long identical regex
by thanos1983 (Parson) on Jun 20, 2018 at 17:21 UTC

    Hello hippo,

    Thanks for the time and effort. I had no idea that it can be written like this :)

    BR / Thanos

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