## Get's text following a word.

# Reference: https://www.perlmonks.org/?node_id=1185608
# Here given the string, the word after ROLLBACK is extracted

#!/usr/bin/perl
use v5.10;
my $string = "stash_ST1.2.3.4_1.ROLLBACK.check.20170228-101051.435944.
+txt";
# Find "ROLLBACK" from the end of string, in case there's more than on
+e of
# them.
my $i = rindex($string, 'ROLLBACK.');
if ($i >= 0) {
    $i += length('ROLLBACK.'); 
    # Now $i points to the character after the full stop.
    # Find the position of the next full stop after it.
    my $j = index($string, '.', $i);
    if ($j >= 0) {
        my $word = substr($string, $i, $j - $i);
        say $word;
    } else {
        # No full stop after ROLLBACK -- signal an error?
    }
} else {
    # ROLLBACK not found! Signal an error?
}