467,179 Members | 1,167 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

characters from scalar to en array

Hi!

I have a string in a scalar. How can I move the characters to en array.
(The first character go in the first place of array,second....)

Thanks!
Oct 13 '08 #1
  • viewed: 2065
Share:
4 Replies
KevinADC
Expert 2GB
Edit: see my next post..........
Oct 13 '08 #2
KevinADC
Expert 2GB
Maybe this is what you are trying to do:

Expand|Select|Wrap|Line Numbers
  1. my $str = 'somelongword';
  2. my @array = split(//,$str);
  3. print "$_\n" for @array;
Oct 13 '08 #3
Your question makes no sense. Post an example of what you are trying to.

Ok I try demonstrate it:

I have a string in a scalar

Expand|Select|Wrap|Line Numbers
  1. $calar="Hello";
I want move it to array @t
See what I want:

Expand|Select|Wrap|Line Numbers
  1. $t[0]="H";
  2. $t[1]="e";
  3. $t[2]="l";
  4. $t[3]="l";
  5. $t[4]="o";
  6.  
Thanks!
Oct 13 '08 #4
Maybe this is what you are trying to do:

Expand|Select|Wrap|Line Numbers
  1. my $str = 'somelongword';
  2. my @array = split(//,$str);
  3. print "$_\n" for @array;
Yes this is what I wanted. Thanks for your help!
Oct 13 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Mountain Man | last post: by
43 posts views Thread by Vladimir | last post: by
2 posts views Thread by Tom | last post: by
5 posts views Thread by helmut januschka | last post: by
4 posts views Thread by al havrilla | last post: by
5 posts views Thread by Eli | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.