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

Re^2: add double quotes to a perl variable

by casperdaghost (Initiate)
on Nov 15, 2013 at 20:40 UTC ( #1062791=note: print w/replies, xml ) Need Help??

in reply to Re: add double quotes to a perl variable
in thread add double quotes to a perl variable

ok so there was a new line at the end of each interation of while. while adds a new line after each print?
  • Comment on Re^2: add double quotes to a perl variable

Replies are listed 'Best First'.
Re^3: add double quotes to a perl variable
by Kenosis (Priest) on Nov 15, 2013 at 20:49 UTC

    An input record separator (found in Perl's variable $/ and usually set to \n) determines the end of a line ('record') when reading from a file--like you were doing in your while loop. It's kept on the end of the line, unless you do something like chomping the line. In your case, not removing the input record separator produced undesirable results in your final output. (Sometimes, however, the very last line of a file may not terminate with an input record separator, because the line ends at the end of the file.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062791]
[erix]: that's a good one. I must remember that :P
[stevieb]: I really dislike how perlbrew doesn't list your version of perl if a newer minor version bump has happened. eg: I use 5.24.1, but 5.24.2 is available, hiding my 5.24.1. I may look at this, as I made it display correctly in berrybrew in cases like this
[stevieb]: choroba just gleaned your post about Module::Starter. I use it too, pretty much for every dist I write

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-08-18 20:46 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (310 votes). Check out past polls.