Using a regex is one way to do it:
use strict; use warnings; my $string = 'ABCDEFGHIJKLMNOPQ'; my $tail = 'OPQ'; my $preLen = 4; if ($string =~ /(.{$preLen})$tail/) { print "$1\n"; }
Prints:
KLMN
In reply to Re: substring problem???
by GrandFather
in thread substring problem???
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |