jw2523 has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I'm an entry level Perl user and wish to get some help from you.
I have a small program called "Scheduling.pl" as shown below. When I run the program, I receive an error messgae "Use of uninitialized value in print at Scheduling.pl line 22, <STDIN> line 9."
Does anyone know if this is bug in the program or it is caused by the compiler? By the way, I use ActivePerl 5.6.1.
below are some sample data.use warnings; use strict; my @horiz = <STDIN>; chomp(@horiz); my @dates = split '\|', shift @horiz; splice @dates, 0, 3; for my $line (@horiz) { my @flds = split '\|', $line; shift @flds; my $PID = shift @flds; my $SID = shift @flds; my @dates_copy = @dates; for my $date (@dates_copy) { print "$PID|$SID|",shift(@flds),"|$date\n"; } } # for $line
Out put|||12/31/2007|1/1/2008|1/2/2008|1/3/2008|1/4/2008|1/5/2008| |3104|1|New Years|Holiday|Clinic||| |3104|2|New Years|Holiday|Clinic||| |3104|3|New Years|Holiday|Clinic||| |3104|4|New Years|Holiday|AofC Clin||| |3109|1|New Years|Holiday|Clinic||| |3109|2|New Years|Holiday|Clinic||| |3109|3|New Years|Holiday|Clinic||| |3109|4|New Years|Holiday|AofC Clin|||||
Your help would be greatly appreciated.3104|1|New Years|12/31/2007 3104|1|Holiday|1/1/2008 3104|1|Clinic|1/2/2008 3104|1||1/3/2008 3104|1||1/4/2008 3104|1||1/5/2008 3104|2|New Years|12/31/2007 3104|2|Holiday|1/1/2008 3104|2|Clinic|1/2/2008 3104|2||1/3/2008 3104|2||1/4/2008 3104|2||1/5/2008 3104|3|New Years|12/31/2007 3104|3|Holiday|1/1/2008 3104|3|Clinic|1/2/2008 3104|3||1/3/2008 3104|3||1/4/2008 3104|3||1/5/2008 3104|4|New Years|12/31/2007 3104|4|Holiday|1/1/2008 3104|4|AofC Clin|1/2/2008 3104|4||1/3/2008 3104|4||1/4/2008 3104|4||1/5/2008 3109|1|New Years|12/31/2007 3109|1|Holiday|1/1/2008 3109|1|Clinic|1/2/2008 3109|1||1/3/2008 3109|1||1/4/2008 3109|1||1/5/2008 3109|2|New Years|12/31/2007 3109|2|Holiday|1/1/2008 3109|2|Clinic|1/2/2008 3109|2||1/3/2008 3109|2||1/4/2008 3109|2||1/5/2008 3109|3|New Years|12/31/2007 3109|3|Holiday|1/1/2008 3109|3|Clinic|1/2/2008 3109|3||1/3/2008 3109|3||1/4/2008 3109|3||1/5/2008 3109|4|New Years|12/31/2007 3109|4|Holiday|1/1/2008 3109|4|AofC Clin|1/2/2008 3109|4||1/3/2008 3109|4||1/4/2008 3109|4||1/5/2008
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error: Uninicialized Value
by jdporter (Paladin) on Apr 29, 2008 at 16:51 UTC | |
by tye (Sage) on Apr 29, 2008 at 18:11 UTC | |
|
Re: Error: Uninicialized Value
by shmem (Chancellor) on Apr 29, 2008 at 17:08 UTC | |
|
Re: Error: Uninicialized Value
by toolic (Bishop) on Apr 29, 2008 at 16:56 UTC | |
|
Re: Error: Uninicialized Value
by apl (Monsignor) on Apr 29, 2008 at 17:13 UTC | |
|
Re: Error: Uninicialized Value
by jwkrahn (Abbot) on Apr 29, 2008 at 17:38 UTC | |
|
Re: Error: Uninicialized Value
by dwm042 (Priest) on Apr 29, 2008 at 17:37 UTC | |
|
Re: Error: Uninicialized Value
by jw2523 (Initiate) on Apr 29, 2008 at 17:59 UTC |