Why aren't newlines being printed in this Perl code?

前端 未结 3 1156
清歌不尽
清歌不尽 2020-12-12 04:17

I have some simple Perl code:

#!/usr/bin/perl

use strict;   # not in the OP, recommended
use warnings; # not in the OP, recommended

my $val = 1;
for ( 1 ..         


        
3条回答
  •  甜味超标
    2020-12-12 04:54

    It is possible that the line is interpreted as follows

    (print($val / 8050)) . " \n";
    

    i.e. the parentheses being used as delimiters for a function argument list, with the ."\n" being silently discarded. Try:

     print( ($val/8050) . "\n" );
    

提交回复
热议问题