• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

perl, how to extract pattern into an array

$string = "First YEAR_95, then YEAR_97,  then YEAR_99";
How to extract pattern YEAR_nn in to an array so $ary[0] = 'YEAR_95', $ary[1] = 'YEAR_97', and so on.
0
rgbcof
Asked:
rgbcof
1 Solution
 
wilcoxonCommented:
my @arr = $string =~ m{(YEAR_\d\d)}g;
0
 
rgbcofAuthor Commented:
That works great.  Thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now