in reply to Strange behavior with STDIN
G'day slugger415,
The effect you're seeing with the four characters of ".mp3" overwriting the first four characters of "newfile", generally indicates an embedded carriage return. Such as:
$ perl -e 'my $x = "newfile"; my $y = "\r.mp3"; print "$x$y\n"' .mp3ile
You haven't shown your whole code, or cut it down to something that reproduces the behaviour (see SSCCE).
I suspect you haven't used the strict and warnings pragmata: they're certainly not included with the code you posted.
Your $str appears to be a package variable: action-at-a-distance is a possibility.
Interspersing \n and $/ is questionable. Why are you doing this?
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange behavior with STDIN
by slugger415 (Monk) on Oct 26, 2021 at 16:56 UTC | |
by ikegami (Patriarch) on Oct 26, 2021 at 19:26 UTC |