Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Strange behavior with STDIN

by slugger415 (Monk)
on Oct 26, 2021 at 16:56 UTC ( [id://11138079]=note: print w/replies, xml ) Need Help??


in reply to Re: Strange behavior with STDIN
in thread Strange behavior with STDIN

Thank you for the helpful response. I was using strict but not warnings; adding the latter uncovered a couple of minor issues unrelated to this.

Oddly what did work was adding two chops (not chomps).

chop $str; chop $str;

Odd because I've never run across this problem before.

As to why I'm interspersing \n and $/, well let's just call it lazy typing, sometimes one seems easier than the other. :-)

Thanks again.

Replies are listed 'Best First'.
Re^3: Strange behavior with STDIN
by ikegami (Patriarch) on Oct 26, 2021 at 19:26 UTC

    $str =~ s/\s+\z//; is a far better (and more portable) solution.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2024-04-16 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found