Johan wrote:
>
> The last line of this code
> foreach $PkgFile( @$PkgList )
> {
> if( $PkgFile =~m/^\s*$/)
>
> gives this warning message
> Use of uninitialized value in pattern match (m//) at packagefile.pm
> line 838.
>
> How can I solve this? (I have no idea what the code does...)
Some elements of @$PkgList are undefined. Beware that this may point to
errors in the preceding code that creates the array, but you can avoid
the warning by writing:
foreach $PkgFile (@$PkgList) {
next unless defined $PkgFile;
if ($PkgFile =~ /^\s*$/) {
:
:
}
}
If you expect to spend much time working on this program then it is also
well worth putting
use strict;
at the start, if it is not already there, and declaring all variables
with 'my'.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/