#!/usr/bin/perl -w use strict; use warnings; print "Enter the string ="; my $str = ; chomp $str; #### here is the call to chomp print "Enter the size ="; my $n = ; print "The Length of the string = ",length($str); if ($n <= length($str)){ my $x = pretty_print($str,$n); print "\nThe substring is = ",$x; } else{ print"\nThe length of the string is shorter than the size "; } sub pretty_print{ my ($dna,$len) = @_; my $substring = substr($dna,0,$len); return $substring; }