in reply to Re: iterating through scalar
in thread iterating through scalar

Sorry for asking such question,as i am new to perl. What i need is ,i have a scalar element $name='krishna'.I need to print only any one of the character in the string like i need only 'i' to be printed.

Replies are listed 'Best First'.
Re^3: iterating through scalar
by AnomalousMonk (Archbishop) on Mar 19, 2015 at 19:58 UTC

    Maybe something like this:

    c:\@Work\Perl\monks>perl -wMstrict -le "my $name = 'krishna'; print substr $name, 2, 1; " i
    See substr.


    Give a man a fish:  <%-(-(-(-<

      Thanks for your kind reply.