in reply to Getting element of array with a match
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my @array1 = qw(fil01_sw100056_02.04.js mn_sw100868_15.17.js roof_app01_sw12345_26.02.hex roof_dir01_sw101481_01.32 +.dir); my @array2 = qw(fil01_sw100056_02.03.js mn_sw100868_15.16.js roof_app01_sw101483_25.05.hex roof_dir01_sw101481_01.2 +5.dir); my $string = 'filswjs'; (my $regex = $string) =~ s/(.)(?=.)/$1.*/g; say for grep /$regex/, @array1, @array2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting element of array with a match
by Eily (Monsignor) on Dec 09, 2014 at 14:31 UTC |