#!/usr/bin/perl #For modifying portions of a string, using the substr operator $SampleString = "This here is a sample string"; $FirstExcerpt = substr($SampleString, 5, 4); #The substr operator requires the name of the string, the first digit to start the excerpt #and how many characters -- or offset -- to excerpt. If no offset is specified, the rest of #the string is excerpted. The above line excepts the word "here": print $FirstExcerpt, "\n"; $SecondExcerpt = substr($SampleString, -13, 6); #Excerpts can also be started from the back, using starting from -1. The above excerpt prints #the word "sample": print $SecondExcerpt, "\n";