Hi Johan,

Ok so lets first of all see what is in this variable called: $PkgList

I suggest using a command like, just before the foreach loop (for testing
puropses):
use Data::Dumper;
print Dumper $PkgList;
You can remove this after a single run, this will print the contents of the
variable to STDOUT.

It will be an list of values, or data structures (since the next line does a
text match I would say values is the most likely thing to show up) some of
which might be empty or the entire list might be empty. In any case it is
good to have a look and see what data we are playing with.

Even the empty values are not a problem as long as they are values they are
fine for a patren match. It is the undef values that are causign the problem
here, there are a lot of ways to fix this, one could prevent the undef
values from showing up in the array in the first place, but that might cause
problems further along the code.
Since you already you do not know what this does, it would be wise to cause
as little problems as possible and simply prevent the match from being done
on undefined values.

To do this one can simply add the following line just above the if statment
(don't forget to close the if statents opening braces at the end of the if
statment you are putting this around:
if ( defined $PkgFile ) {
This will lead to the code looking like this:
 foreach $PkgFile( @$PkgList )
 {
  if ( defined $PkgFile ) {
   if( $PkgFile =~m/^\s*$/) ....
  }
This way you are certain you will only attempt to match the value if it is
defined (a value assigned to that part of the array.

Regards,

Rob Coops
On Mon, Mar 31, 2008 at 3:17 PM, Johan <[EMAIL PROTECTED]> 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...)
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

Reply via email to