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
written as 'abcd'.


Chris, you are still sending multipart/mixed messages.

And your sig is still broken: many of its characters
don't belong to the printable subset of their encoding.
  http://en.wikipedia.org/wiki/ISO-8859-1

-- 
Affijn, Ruud

"Gewoon is een tijger."



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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;'
>

Miles de gracias

Cheers,
Umesh


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 PROTECTED]
 


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 commands, e-mail: [EMAIL PROTECTED]
 




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);
foreach $i (@arr) {
   print $i."\n";
}

This gives me
1
2
3

This works fine for me.
I want an alternative solution, if any.

TIA,

Cheers,
Umesh.