main.pl: #!/usr/bin/perl
use strict;
use warnings;
use v5.14;
use ReadData;
my $read = ReadData->new();
my @name = $read->getNames();
$read->printNames(@name);
ReadData.pm: #!/usr/bin/perl
我需要從一個文件讀取數據,遍歷它並將該行寫入另一個文件。當行數達到閾值時,關閉輸出文件句柄並打開一個新句柄。 如何避免每次從輸入文件句柄中讀取一行時打開和關閉輸出文件句柄? use autodie qw(:all);
my $tot = 0;
my $postfix = 'A';
my $threshold = 100;
open my $fip, '<', 'input.txt';
我用圖表模塊生成CSV數據PNG格式的圖表時擺脫未定義值的警告: 它運作良好,圖表看行不行,但是我得到該undef值警告(有在上圖的最後3個這樣的值): # ~/txv3.pl "./L*TXV3*.csv" > /var/www/html/x.html
Generating chart: L_B17_C0_TXV3LIN_PA3_TI1_CI1
Use of uninitialized va