develooper Front page | perl.beginners | Postings from September 2009

accessing chars in a string

Thread Next
From:
Chuck Crisler
Date:
September 1, 2009 17:51
Subject:
accessing chars in a string
Message ID:
1251852568.2736.93.camel@localhost.localdomain
How do I access specific character positions in a scalar string? In case
it makes any difference, I specifically want to test the zeroth
character. Something like the following.

my $str = "abc";
if ($str[0] == '#')
{
	do something...
}

Thank you in advance!
Chuck


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About