473,386 Members | 1,803 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,386 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 2540
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.