Each char / letter --> array from string value

2005-12-28 Thread Umesh T G
Hi List, I need to put each letter from a string to an array. I am doing it this way and it works. I wanna know if there is any other better way to do this / a built-in function. #! /usr/bin/perl $srt ="123"; $sl = length $srt; $val= join (':', split(/ */, $srt) ); @arr = split(/:/,$val); for

Re: Each char / letter --> array from string value

2005-12-28 Thread Adriano Ferreira
On 12/28/05, Umesh T G <[EMAIL PROTECTED]> wrote: > I need to put each letter from a string to an array. The usual way to tear apart a string into an array with characters is @chars = split '', $string; It is documented at C. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: Each char / letter --> array from string value

2005-12-28 Thread Chris Devers
On Wed, 28 Dec 2005, Umesh T G wrote: > I want an alternative solution, if any. Here's one: $ perl -le '$i = "abcd"; @j = split //, $i; print join "\n", @j;' a b c d $ -- Chris Devers 0ª¸IQ'‘éL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: Each char / letter --> array from string value

2005-12-28 Thread Umesh T G
On 12/28/05, Adriano Ferreira <[EMAIL PROTECTED]> The usual way to tear apart a string into an array with characters is @chars = split '', $string; It is documented at C. On 12/28/05, Chris Devers <[EMAIL PROTECTED]> wrote: > > $ perl -le '$i = "abcd"; @j = split //, $i; print join "\n", @j;'

Re: Each char / letter --> array from string value

2005-12-29 Thread Dr.Ruud
Chris Devers: > $ perl -le '$i = "abcd"; @j = split //, $i; print join "\n", @j;' A good alternative to [print join "\n", @list] is to set the (see perldoc perlvar) to "\n". perl -le "$,=qq{\n}; print split //, q{abcd}" The qq{} is to make it work under CMD.EXE too, the q{abcd} can also be w