Mega Code Archive

 
Categories / Perl / String
 

Using substr with the string, offset (2) and length (3)

#!/usr/bin/perl use warnings; use strict; my $string = "hello there\n"; print "The original string: ", 'hello there\n', "\n\n"; # Using substr print substr( $string, 2, 3 ), "\n";