develooper Front page | perl.beginners | Postings from December 2002

Re: transforming strings to an array of characters

Thread Previous | Thread Next
From:
Mystik Gotan
Date:
December 9, 2002 08:45
Subject:
Re: transforming strings to an array of characters
Message ID:
F80OJi57n6Hj1yNrU9H0000a301@hotmail.com
If not using length() direcly on @world_list:

@word_list = qw(bla bla bla bla bla joah hey);

foreach $element (@word_list) {
local($content);
my(@lengths);
$content = length($element);
push(@lengths, $element); # or different order, I always forgot this :)
}



--------------
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: gotan2k3@hotmail.com





>From: "Tanton Gibbs" <thgibbs@deltafarms.com>
>To: "Erik Browaldh" 
><eribro@Pool.Informatik.RWTH-Aachen.DE>,	<beginners@perl.org>
>Subject: Re: transforming strings to an array of characters
>Date: Mon, 9 Dec 2002 07:35:04 -0500
>
>I know this has already been answered, but usually you can do things more
>efficiently on the string itself...what are you trying to do?
>
>Tanton
>----- Original Message -----
>From: "Erik Browaldh" <eribro@Pool.Informatik.RWTH-Aachen.DE>
>To: <beginners@perl.org>
>Sent: Monday, December 09, 2002 7:24 AM
>Subject: transforming strings to an array of characters
>
>
> > hi everyone!
> >
> > if  I have a string, lets say
> > $word="perl";
> >
> > I want to copy this so I have something like this:
> > @word_list["p","e","r","l"]
> >
> > also, how do I get the length of @word_list?
> >
> > thanks in advance!
> > Erik
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> > For additional commands, e-mail: beginners-help@perl.org
> >
> >
> >
>
>
>--
>To unsubscribe, e-mail: beginners-unsubscribe@perl.org
>For additional commands, e-mail: beginners-help@perl.org


_________________________________________________________________
Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/


Thread Previous | 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