Perl get first characters

Code examples

1
0

perl get first characters

# For Perl (language) only

# syntax
substr(<your-string>,0,<characters-to-extract>)

# example 
substr("Cool, isn't it!",0,4)

# application
my $sRandom = "Cool, isn't it!";
my $s1stFewChars = substr($sRandom,0,4);
print "[ sRandom : '$sRandom' ] \n[ s1stFewChars : '$s1stFewChars' ]" . "\n";

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................