If the offset is negative, substr counts from the end of the string
#!/usr/bin/perl -w # Extract substring. $string = "One Two Three"; $new_string = substr($string, -5); print "Substring is \"$new_string\".\n";