PDA

View Full Version : Uninitialized value problem


Nico
11-26-2002, 10:31 PM
A friend of mine and I are having a problem with this and we're sure its something easy but can't figure it out. The error follows as well as the errored code. PLEASE help if you can!

Use of uninitialized value in print at ./parser.pl line 149.
Use of uninitialized value in substitution (s///) at ./parser.pl >line 168.
Use of uninitialized value in substitution (s///) at ./parser.pl >line 169.
Use of uninitialized value in split at ./parser.pl line 174.

the function is passed a reference to an array, which is pulled from an array (done in a while loop)

164 sub getname {
165 my ($aref, @aref, $tmp);
166 $aref = $_;
167
168 $aref[1] =~ s/^\s+//;
169 $aref[1] =~ s/\s+$//;
170
171 # loop through the days passed in :)
172
173
174 $tmp = split /,/, $aref[1];
175 $tmp = reverse $tmp;
176 print "\nname of employee is $tmp";
177 return $tmp;
178 }