admin2 wrote:
How can I suppress the first "Use of uninitialized value in pattern
match (m//)" warning message. code and output are below.
---- code ----
# cat ./fix_archive.pl
#!/usr/bin/perl
use warnings;
use strict;
my @files = <*> unless /.mbox^/;
That line reads as:
my @files = <*> unless $_ =~ /.mbox^/;
So you have to put something into $_ to remove the warning message.
And then you have to fix the problem described in perlsyn:
<QUOTE>
NOTE: The behaviour of a "my" statement modified with a statement
modifier conditional or loop construct (e.g. "my $x if ...") is
undefined. The value of the "my" variable may be "undef", any
previously assigned value, or possibly anything else. Don’t rely
on it. Future versions of perl might do something different from
the version of perl you try it out on. Here be dragons.
</QUOTE>
That should be written something like:
my @files = grep !/.mbox\^/, <*>;
foreach my $file (@files) {
print $file . "\n";
}
---- code ---
here is the output
# ./fix_archive.pl
Use of uninitialized value in pattern match (m//) at ./fix_archive.pl
line 6.
add_members
arch
b4b5-archfix
change_pw
check_db
check_perms
cleanarch
clone_member
config_list
convert.py
convert.pyc
discard
dumpdb
export.py
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/