5% assure discount from here only

Tuesday, January 25, 2011

(8) How to access or change a particular characters of a string?

Solution :

$string = "Just another Perl Hacker";
$first_char = substr( $string, 0, 1 ); # 'J'

To change part of a string, you can use the optional fourth argument
which is the replacement string.

substr( $string, 13, 4, "Perl 5.8.0" );

No comments:

Post a Comment