#!/usr/local/bin/perl use strict; use warnings; my $string = "This is what you have"; if(substr($string, -10) =~ /have/){ print "Pattern maches in last 10 characters\n"; }