Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: display problem

by steph_bow (Pilgrim)
on Mar 04, 2008 at 10:09 UTC ( [id://671835]=note: print w/replies, xml ) Need Help??


in reply to Re: display problem
in thread display problem

Dear Moritz,

Thanks a lot for your help

But this is what I get from the display

;04:20ELLO

Instead of

song HELLO;04:20

But it works when I do

chop($song);

Could you tell me why ? Thanks a lot

Replies are listed 'Best First'.
Re^3: display problem
by moritz (Cardinal) on Mar 04, 2008 at 10:18 UTC
    Maybe your line endings are not the same as $/?

    The line endings on linux (LF), windows (CR LF) and Mac OS (CR? not sure...) are different, so if the input file has different line endings than your system, you have to set $/ to that value manually.

    chop just removes the last character, independently of what it is.

    The most generic solution might be $song =~ s/\s+$//, which removes all trailing whitespaces, and all line endings are considered to be whitespaces.

    See perlvar for the meaning of $/.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://671835]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found