in reply to Re^3: Reformat RAW Excel Data
in thread Reformat RAW Excel Data
Glad you got it working. Couple of suggestions:
One of the benefits of clear syntax is that it enables you to spot typos, such as the stray#!/bin/perl use strict; use warnings; my @months = ('', qw/jan feb mar apr may jun jul aug sep oct nov dec/) +; print($_, "\t") for @months; print "\n"; my (%report, $cust); open(my $DATA, '<', 'sales.txt') or die "Open failed: $!"; while (<$DATA>) { chomp; if ( /^[A-Z]/ ) { $cust = $_; @{ $report{$cust} } = map { 0 } @months; next; } my ($date, $value) = split ' ', $_; my ($mon, $year) = split '/', $date; $report{$cust}[$mon] = $value; } foreach my $cust (keys %report) { print $keys,"\t"; print($report{$cust}[$_], "\t") for 0 .. 12; } print "\n";
in your code above.} print "\n";
Hope this helps!
|
|---|