Meghna has asked for the wisdom of the Perl Monks concerning the following question:

I am writing the output of a perl code into a file "output.csv". But "Nul" gets written in the first line of output (2 times). The code that i have used for writing in the file is:

print OUT "\n$input[0]| $freemac | $ip_req | $freeclient_ip[1]";

I have tried chomp() too, but nothing is happening. Please help

Replies are listed 'Best First'.
Re: Unwanted character in output file
by hippo (Archbishop) on Mar 28, 2018 at 10:43 UTC
Re: Unwanted character in output file
by AnomalousMonk (Archbishop) on Mar 28, 2018 at 15:28 UTC

    I don't understand what "Nul" is. Is it the  'Nul' literal string? Is it some representation of undef — and are you use-ing warnings (and strict) at the start of your program? Is it something else I haven't imagined? (Update: I know the title of the OP includes the word "character," which implies \0, but still...) Can you please elaborate (preferably in the form of an SSCCE)?


    Give a man a fish:  <%-{-{-{-<