Chuck Crisler wrote:
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...
}

if ( substr( $str, 0, 1 ) eq '#' )


if ( index( $str, '#' ) == 0 )


if ( $str =~ /^#/ )




John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to