My script generates this warning: "Use of uninitialized value in numeric le (<=) at script.pl line 416."
The problem is that line 416 is just checking for a matching regular expression. The script is kind of big, but here's lines 406-425:
for (my $i = 0; $i <= $#_; $i++) {
next unless $_[$i] =~ /^(.+?)\.(zip|t?gz|tar|bz2?|tbz)$/i
or $_[$i] =~ /$config_regexp/i
or $_[$i] =~ /banner\d?\.(jpe?g|gif|png)$/i
or $_[$i] =~ /^template\.html?$/i;
my($volume, $directories, $file) = File::Spec->splitpath($File
+::Find::dir);
my @dirs = File::Spec->splitdir($directories);
# unzip any compressed files
if ($_[$i] =~ /^(.+?)\.(zip|t?gz|tar|bz2?|tbz)$/i) {
# sometimes File::Temp can't clean up properly
for (my $x = 0; $x <= $#_; $x++) {
my $dir = File::Spec->catfile($File::Find::dir, $_[$x]
+);
if (-d $dir && $_[$x] =~ /^$1\-EXTRACTED.{5}$/) {
rmtree($dir);
undef $_[$x];
}
}
Does anyone have an idea what the problem might be? I thought it might have something to do with undefining an array element while looping over the array, but I can't reproduce it outside this script.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.