Hi,

Here is a test case:

#!perl -w
@ARGV=('-x','tonus','mbx','5','2-4','-x');
$n=0;
grep {(/^-x$/ && splice (@ARGV,$n,1) && ($n > $#ARGV || ($ext =  
splice(@ARGV,$n--,1)))) || ++$n}@ARGV;
print "n=$n, ext=$ext, argv=@ARGV\n";
__END__

The output is:

        # Use of uninitialized value. (.. line 4)
        n=3, ext=tonus, argv=mbx 5 2-4

The variables $ext and @ARGV take the values I want, but I can't figure out what is 
the "uninitialized value". Any hint ?

NB: the goal is to strip "-x aaa" pairs off @ARGV, including the lone "-x" at the end, 
and have the last "aaa" in $ext.

Thanks

Reply via email to