Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl Script New Line problem

by perl.j (Pilgrim)
on Dec 21, 2011 at 15:48 UTC ( #944650=note: print w/replies, xml ) Need Help??


in reply to Perl Script New Line problem

If you are using Perl v5.12 and up, you can simply say

 say $out_fh $line

say automatically adds a newline

--perl.j

Replies are listed 'Best First'.
Re^2: Perl Script New Line problem
by Anonymous Monk on Dec 21, 2011 at 16:29 UTC

    not by default, but only if you enable modern perl, say through Modern::Perl or -E

    $ perl -e " say 1 Number found where operator expected at -e line 1, near "say 1" (Do you need to predeclare say?) syntax error at -e line 1, near "say 1" Execution of -e aborted due to compilation errors. $ perl -E " say 1 1
      Or he can simply say use 5.12.x.
      --perl.j

        Did you try it?

        $ perl -e " use 5.12.x; " syntax error at -e line 1, near "use 5.12" Execution of -e aborted due to compilation errors.

        Suggesting say is nice, if you explain how to actually enable it :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944650]
help
Chatterbox?
[Perl300]: Hi all
[Perl300]: I need suggestion for a module that'll help me to send email from my perl code. I want it secure and as simple as possible.
[Perl300]: I found from Super Search
[Perl300]: I found from Super Search, Net::SMTPS or Net::SMTP, MIME::Lite, Email as options
[1nickt]: Perl300 Try Email::Stuffer
[1nickt]: Or for a little more control, Email::Sender:: Simple

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-10-17 15:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (233 votes). Check out past polls.

    Notices?