M
Marek Stepanek
Hello all,
I have some numbers to calculate (DATA). Each line represent a new day,
which are calculated with the subroutine "add_one_day"
But I can't get rid of the warnings, which I don't understand:
Use of uninitialized value in concatenation (.) or string at
../excel_autorech_test.pl line 35, <DATA> line 20.
Could somebody be so kind, and look through this script?
Thank you and best greetings from Munich
marek
#! /usr/bin/perl -w
use strict;
use Date::Calc qwall);
my $start_day = "01";
my $start_month = "06";
my $year = "2006";
my $day = $start_day;
my $month = $start_month;
my ($date, $wochentag);
my @lines;
while (<DATA>)
{
s/,/./g;
push @lines, $_ if (/^[\d,.\t\s]+$/ || /^$/);
}
foreach my $line (@lines)
{
if ($line =~ /^$/)
{
add_one_day($year, $month, $day);
print "$wochentag, $date: hurray, there is an empty line, but one
day more!\n";
}
elsif ($line=~ /[\d.\t]+/)
{
add_one_day($year, $month, $day);
print "$wochentag, $date: hurray, there is some stuff to
calculate!\n\t$line\n";
}
}
sub add_one_day
{
my $day_plus = 1;
my ($year2, $month2, $day2) = Add_Delta_Days($year, $month, $day,
$day_plus);
my $dow = Day_of_Week($year2,$month2,$day2);
Language(Decode_Language("Deutsch"));
my $lang = Language_to_Text(Language());
my $wochentag = Day_of_Week_Abbreviation($dow);
$month2 = sprintf("%02d", $month2);
$day2 = sprintf("%02d", $day2);
$date = "$day2.$month2.$year2";
($day, $month, $year) = ($day2, $month2, $year2);
# print "here for test reasons: $wochentag, $date, $year, $month,
$day\n\n";
return ($wochentag, $date, $year, $month, $day);
}
__DATA__
27192,1 10882,6 591 16 6138,5
27476,3 10990,7 596 16 6298,8
27737,9 11146,8 301 16 6523,1
27775,2 11158,5 604 16 6553,4
28179,1 11362,1 611 16 6863,3
28489,7 11524,2 619 16 7116,7
28752,1 11683,2 624 16 7849,6
29191,3 11882,2 618 16 7622,8
29290,8 11961,2 633 16 7746,7
29549,4 12109,9 638 16 7964,0
29778,4 12180,8 640 16 8063,2
30172,2 12364,1 644 16 8321,0
30282,0 12416,7 647 16 8401,1
30483,5 12506,1 652 16 8541,2
30769,3 12668,7 660 16 8788,6
30992,9 12725,4 662 16 8873,2
I have some numbers to calculate (DATA). Each line represent a new day,
which are calculated with the subroutine "add_one_day"
But I can't get rid of the warnings, which I don't understand:
Use of uninitialized value in concatenation (.) or string at
../excel_autorech_test.pl line 35, <DATA> line 20.
Could somebody be so kind, and look through this script?
Thank you and best greetings from Munich
marek
#! /usr/bin/perl -w
use strict;
use Date::Calc qwall);
my $start_day = "01";
my $start_month = "06";
my $year = "2006";
my $day = $start_day;
my $month = $start_month;
my ($date, $wochentag);
my @lines;
while (<DATA>)
{
s/,/./g;
push @lines, $_ if (/^[\d,.\t\s]+$/ || /^$/);
}
foreach my $line (@lines)
{
if ($line =~ /^$/)
{
add_one_day($year, $month, $day);
print "$wochentag, $date: hurray, there is an empty line, but one
day more!\n";
}
elsif ($line=~ /[\d.\t]+/)
{
add_one_day($year, $month, $day);
print "$wochentag, $date: hurray, there is some stuff to
calculate!\n\t$line\n";
}
}
sub add_one_day
{
my $day_plus = 1;
my ($year2, $month2, $day2) = Add_Delta_Days($year, $month, $day,
$day_plus);
my $dow = Day_of_Week($year2,$month2,$day2);
Language(Decode_Language("Deutsch"));
my $lang = Language_to_Text(Language());
my $wochentag = Day_of_Week_Abbreviation($dow);
$month2 = sprintf("%02d", $month2);
$day2 = sprintf("%02d", $day2);
$date = "$day2.$month2.$year2";
($day, $month, $year) = ($day2, $month2, $year2);
# print "here for test reasons: $wochentag, $date, $year, $month,
$day\n\n";
return ($wochentag, $date, $year, $month, $day);
}
__DATA__
27192,1 10882,6 591 16 6138,5
27476,3 10990,7 596 16 6298,8
27737,9 11146,8 301 16 6523,1
27775,2 11158,5 604 16 6553,4
28179,1 11362,1 611 16 6863,3
28489,7 11524,2 619 16 7116,7
28752,1 11683,2 624 16 7849,6
29191,3 11882,2 618 16 7622,8
29290,8 11961,2 633 16 7746,7
29549,4 12109,9 638 16 7964,0
29778,4 12180,8 640 16 8063,2
30172,2 12364,1 644 16 8321,0
30282,0 12416,7 647 16 8401,1
30483,5 12506,1 652 16 8541,2
30769,3 12668,7 660 16 8788,6
30992,9 12725,4 662 16 8873,2