in reply to new : greping

Version of code that reads the data from a file. Data is identical to that in the __DATA__ section of my previous post.

use warnings; use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("data.xls"); my $worksheet = $workbook->add_worksheet(); $worksheet->write ("A1", 'Device'); $worksheet->write ("B1", '/var'); $worksheet->write ("C1", '/'); $worksheet->write ("D1", 'interleaved'); my $row = 2; open inFile, '<', 'data.txt' or die "Couldn't open data.txt: $!"; while (<inFile>) { my ($p1, $p2, $p3, $device) = /(?:\. ){3}(\d+)%\s\/var\s(\d+).*?(\d+ +)%\sInterleaved (\w+)/; $worksheet->write("A$row", $device); $worksheet->write("B$row", $p1); $worksheet->write("C$row", $p2); $worksheet->write("D$row", $p3); ++$row; print "$device $p1, $p2, $p3\n"; } $workbook->close (); close inFile;

Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: new : greping
by pingme8705 (Acolyte) on Sep 08, 2005 at 04:51 UTC
    hi grandfather ! It gave an error mesg : " use of unintialised value in concatanation or string " i am checking on it !