in reply to Regex MATCH

hi,

If I understand your question, you want to match the line that has HYPHEN towards end of the lines. If so, the below script does that

use warnings; use strict; while ( defined( my $line = <DATA> ) ) { chomp $line; print $line, $/ if $line =~ m/\-[0-9a-z]{3}/; } __DATA__ DOC_001_123 DOC_002_214 DOC_001-548 DOC_001-987
Output
DOC_001-548 DOC_001-987
UPDATE:
You really can see, how your Regex matches, using
use re 'debug';
in your script or you can get explanation of a regular expression using YAPE::Regex::Explain

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me