#!/usr/bin/perl use warnings; use strict; my $string = "hello there\n"; print "The original string: ", 'hello there\n', "\n\n"; my $substring = substr( $string, 0, 5, "Bye" ); print "The string after the replacement: $string"; print "The substring that was replaced: $substring\n\n";