Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Implementation of Readline

by shyam123 (Initiate)
on Jun 13, 2013 at 09:27 UTC ( #1038711=perlquestion: print w/ replies, xml ) Need Help??
shyam123 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,
I am trying to read from the serial device.I have tied with file handler and i access through it's file handler functions.My buffer size is 512 and i try to read only 40 bytes.And then display the 40 bytes line by line.I knew the existence of readline function which does the same,but i don't want to use that.The bytes i read are,
hi\nhow are
u\nhello iam fine\n
\nthe world\n is ve
ry beautiful\n
And i write "wow" string on to the serial device once i read the string "hello".After sending the data i read other two lines
. In short, both TX and RX are taking place on serial port and i need to read 40(or whatever is available) number of bytes.My output should be as below
how are u
hello i am fine
the world is very beautiful
I was trying split function,but i am not getting the appropriate output when the new line character comes in the next line.Can anyone throw some light on this.It would also be fine if anyone can jus share the snippets

Comment on Implementation of Readline
Re: Implementation of Readline
by BrowserUk (Pope) on Jun 13, 2013 at 10:17 UTC

    I've read your description through 3 times, but it is still not clear to me what your problem is, or how we can help you.

    There is nothing wrong with the words you've posted, they are very clear, but they do not allow me to begin to guess what your code looks like. But then, why should I need to guess?

    Maybe if you posted your current code and demonstrated what output it is giving you now, we might be able to see how to modify it to produce the output you told us you want.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1038711]
Approved by BrowserUk
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-26 02:14 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (175 votes), past polls