Hello soulbleach, and welcome to the Monastery!
Note that the regex in this line:
my @strings = $line =~ m/(RC[0-9][0-9][0-9][0-9])/;
contains only a single capture, so if the match succeeds @strings will contain only one element. Did you intend more than one capture per $line? If so, you need to add a /g modifier to the regex:
my @strings = $line =~ m/(RC[0-9]{4})/g;
Update: See “Global matching” in perlretut. (Also shortened regex: see “Quantifiers” in Regular Expressions.)
But without sample input data and desired output, it’s hard to know what you’re trying to do.
Anyway, hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Newbie, need help extracting strings from two files and comparing
by Athanasius
in thread Newbie, need help extracting strings from two files and comparing
by soulbleach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |