in reply to Regex problem
As an alternative to the regular expression ikegami showed you, you can use rindex and substr to locate and extract your text. You might find this a little easier to understand (after you read the manual pages). For example:
use strict; use warnings; my $pos = 21; my $str = "ABCDEFANABCDEFGHIJKLMNOPQRSTVVWXWZ"; my $pos_fan = rindex($str, "FAN", $pos); print substr($str, $pos_fan + 3, 3) . "\n";
produces
ABC
|
|---|