473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

characters from scalar to en array

62
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
4 2541
KevinADC
4,059 Expert 2GB
Edit: see my next post..........
Oct 13 '08 #2
KevinADC
4,059 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
Arepi
62
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
Arepi
62
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

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

Similar topics

2
by: Mountain Man | last post by:
Hi, I have an array derived from a set of radio buttons that I want to break down into a single variable for use with a database. How can I do this? $gender is the array, and I want $gender2 to...
43
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character...
2
by: Tom | last post by:
In C, I can just read the K&R book and know how everything is pretty much coded at the machine level. At least to some extent. But how does Perl know when you type print $ref for example...
5
by: helmut januschka | last post by:
hi !, Following Code gives me following error's warning: excess elements in scalar initializer char *functionname = { "abs", "sqrt", "sin", "cos", "atan", "log", "exp", "\0"
4
by: al havrilla | last post by:
hi all what does the phrase: "scalar deleting destructor" mean? i'm getting this in a debug error message using c++ 7.1 thanks Al
5
by: Eli | last post by:
Hi, I want to check whether a value is a scalar. A scalar can be: - None (null) - string - number (integer, float) - boolean How can I validate a value is one of these types? I care about...
5
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy...
2
by: alnoir | last post by:
I've looked around online and have even had a friend help me, however, for some reason I can't compare two strings. I'm doing this at the end of the code (within the two foreach loops), above...
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.