hi, I am a beginer in PERL. got stuck in trying to figure out how strings are converted to character arrays.
for ex: I want to convert @str1=("apple") to a charcter array like
@chr1=('a','p','p','l','e')
can some one help me how to implement the above?
I basically need to get a string form the user and address each character(letter) of that string. well, iam in the middle of my assignment...so a quick reply from any one is appreciated.
regards,
bhanumathy.
11 42632
I am also having the same problem. Let me know if you find a solution!
Thanks
I want to convert @str1=("apple") to a charcter array like
@chr1=('a','p','p','l','e')
can some one help me how to implement the above?
A function for doing that was implemented in Perl a long time ago. Time to RTFM?
TFM: http://perldoc.perl.org/functions/split.html
Yeah, that's indeed the function I was thinking of. ;)
My point is that being a beginner isn't an excuse for asking for help without first making a serious effort to find the answer by help of the docs. Browsing the perlfunc manpage for a suitable function should always be part of such an effort IMO. Now I had told him that there is an applicable function, which should have been enough of a pointer.
There are too many people nowadays who expect to be spoon feeded. :(
I am also having the same problem. Let me know if you find a solution!
Thanks
Hi,
check out this link.
http://perldoc.perl.org/functions/split.html
hi, I am a beginer in PERL. got stuck in trying to figure out how strings are converted to character arrays.
for ex: I want to convert @str1=("apple") to a charcter array like
@chr1=('a','p','p','l','e')
can some one help me how to implement the above?
I basically need to get a string form the user and address each character(letter) of that string. well, iam in the middle of my assignment...so a quick reply from any one is appreciated.
regards,
bhanumathy.
Hi ,
use the following code for ur problem
@chars=split(/(?=\w)/,$string);
Regards ,
sharif.
@chars=split(/(?=\w)/,$string);
Slightly overcomplicated there sharif. This works just as well, and is quite a bit easier to read, I think. -
@chars = split '', $string;
-
Again, they should just read the manual: http://perldoc.perl.org/functions/split.html
"spoon feeded".
I think it's time for you to RTF Dictionary!!
litenin
Yeah, that's indeed the function I was thinking of. ;)
My point is that being a beginner isn't an excuse for asking for help without first making a serious effort to find the answer by help of the docs. Browsing the perlfunc manpage for a suitable function should always be part of such an effort IMO. Now I had told him that there is an applicable function, which should have been enough of a pointer.
There are too many people nowadays who expect to be spoon feeded. :(
"spoon feeded".
I think it's time for you to RTF Dictionary!!
litenin
Litenin,
First, this is a place of learning. Being condescending as you were is not beneficial to those trying to learn something. Sometimes spoon feeding a person something is the way to get them to learn, sometimes it isn't. It all depends on the situation. Lets try to be a little more understanding of those who do not "know it all".
Also, seeing as how this thread is a year and a half old, I doubt that the original OP will be reading it. Besides, they have probably have learned this material already.
Regards, Moderator
In Litenin's defense... it appears he was taking a poke at GunnarH for using the word "feeded" instead of "fed" in GunnarH's belittling of the requestor for asking for help too soon (hence, the "Dictionary" reference). Litenen was, in fact, defending the newbie, not attacking him.
Litenin,
First, this is a place of learning. Being condescending as you were is not beneficial to those trying to learn something. Sometimes spoon feeding a person something is the way to get them to learn, sometimes it isn't. It all depends on the situation. Lets try to be a little more understanding of those who do not "know it all".
Also, seeing as how this thread is a year and a half old, I doubt that the original OP will be reading it. Besides, they have probably have learned this material already.
Regards, Moderator
lock this thread already.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: lkrubner |
last post by:
Last year I asked a bunch of questions about character encoding on this
newsgroup. All the answers came down to using ord() in creative ways to
try to make guesses about multi-byte characters. I...
|
by: flam |
last post by:
Hello,
I am having a hard time spliting a string into an array for use in a
search. Here is the situation. The user will input a search string.
Normally I can just split the string by "split...
|
by: Tom Warren |
last post by:
I found a c program called similcmp on the net and converted it to vba
if anybody wants it. I'll post the technical research on it if there
is any call for it. It looks like it could be a useful...
|
by: Don Starr |
last post by:
When applied to a string literal, is the sizeof operator supposed to return the size of the string
(including nul), or the size of a pointer?
For example, assuming a char is 1 byte and a char *...
|
by: Opettaja |
last post by:
I am new to c# and I am currently trying to make a program to retrieve
Battlefield 2 game stats from the gamespy servers. I have got it so I
can retrieve the data but I do not know how to cut up...
|
by: Shhnwz.a |
last post by:
Hi,
I am in confusion regarding jargons.
When it is technically correct to say.. String or Character Array.in c.
just give me your perspectives in this issue.
Thanx in Advance.
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: Gangreen |
last post by:
Hi, I'm new to Perl but I have some experience in other languages.
Anyway I need to split a string on the character "|".
let's say our string is "one|two|three"
when I try the following code:...
|
by: est |
last post by:
From python manual
str( )
Return a string containing a nicely printable representation of an
object. For strings, this returns the string itself. The difference
with repr(object) is that...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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: 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...
|
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,...
| |