Hi, I want to test and remove one element of an array when it is '-s'. The following script works, with a diag: Use of uninitialized value, in line 5. It seems related to '-s'. #!/usr/local/bin/perl -w @ARGV = (2, '-s', 'fil'); my $sel = 0; for (0..$#ARGV) { $ARGV[$_] =~ /^-s$/o || next; $sel = 1; splice(@ARGV,$_,1); } print "$sel, @ARGV \n"; __END__ If I replace -s by -\s or -\\s, the diag disappears, but the regex fails. What is a right way to do it ? Thanks
- Re: [MacPerl] Use of uninitialized value. Louis Pouzin
- Re: [MacPerl] Use of uninitialized value. Bart Lateur