I would go with merlyn's while loop, but perhaps do a next unless test on the pattern match, possibly combining assignment if I wanted to use something other than $1, $2, ...:
while(<DATA>){ next unless /(\w+)\.(tiff?)\b/i; print "$1 \t $2\n"; } # or this while(<DATA>){ next unless my($base, $ext) = /(\w+)\.(tiff?)\b/i; print "$base \t $ext\n"; }
In reply to Re: regex for assignment
by danger
in thread regex for assignment
by mkmcconn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |