Each char / letter --> array from string value



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.


Relevant Pages

  • Re: Saving Text File in registry Key
    ... I would read the text as string, convert it to byte array using ... System.Text.Encoding.Default.GetBytesmethod and use the SetValue method ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Split data to 2 new fields
    ... It concatenates the elements of an array into a ... > string. ... Prev by Date: ...
    (microsoft.public.access.gettingstarted)
  • Re: downloadable files
    ... a string is put into ... fh...not an entire array of area information...which when printed looks ... like tons of numbers seperated by comma's. ... Prev by Date: ...
    (alt.php)
  • Re: Newbie:Storing .NET datatypes in disconnected ADO.NET tables
    ... Could it have columns as array of simple ... types like string, etc.? ... Prev by Date: ...
    (microsoft.public.dotnet.framework.adonet)
  • last number array from string
    ... I have a address string with ID numbers at the end and want ... to be able to identify just the array at the end which could be any number in ... as I want to use the number for a lookup, please can anyone help with a ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)