perl.beginners
[Top] [All Lists]

Re: Returning character from string

Subject: Re: Returning character from string
From: Rob Dixon
Date: Mon, 20 Oct 2008 13:29:21 +0100
Newsgroups: perl.beginners

brian54321uk wrote:
>
> Hi, I'm stuck with what will probably turn out to be a simple solution, 
> I've been scouring google for ages, and can't find anything close to 
> what I'm looking for.
> 
> Given that
> 
> $fred = 10
> $barney = abcdefghijklmn
> 
> how do I get $wilma = j

my $wilma = substr $barney, $fred-1, 1;

Rob

<Prev in Thread] Current Thread [Next in Thread>