#!/usr/bin/perl use strict; use warnings; # Example strings my $string1 = "ABCDEFderp12345"; my $string2 = "derp"; # Find position of string2 within string1 my $strpos = index($string1, $string2); # If $strpos is greater than zero (see perldoc index) if ( $strpos >= 0 ){ # Print remainder of the string # See perldoc length, perldoc substr print substr( $string1, ( $strpos + length($string2) ) ); }else{ print "$string2 does not occur within $string1"; }