On Jun 11, DeXteR said:
>I'm writing a program (what else should i do with perl) and now i got to
>get a character from a string, things like that happen those days.
>Like we have string $blah = "abcdef" and i wand for example character 5,
>the "e", to mess around with further. How should i do that?
You want to use substr(), probably:
substr($string, 0, 1); # get the first character
substr($string, 1, 1); # get the second character
# etc.
substr("japhy", 1, 1); # 'a'
substr("japhy", 2, 3); # 'phy'
Read 'perldoc -f substr'. You might also want index(), to find the
occurrence of a substring in another string.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **