After I run your code through perltidy, I get the following:
sub info() {
my $nick = $_[0];
my $reply = $_[1];
my $val = admin($nick);
if ( $reply =~ /a/ ) {
if ( $val == 1 ) {
@info;
foreach my $n (@info) {
writ1("$n");
}
}
}
else {
if ( $val == 1 ) {
@info;
foreach my $n (@info) {
writ1("$n");
}
}
else {
pm( $nick, "^B^C4,1[x] Not auhtorized to see this!^C^B" );
}
}
}
There are some problems with your code. First of all, I consider it bad form to access elements of @_; it's more natural for your prologue to be my ( $nick, $reply ) = @_.
As has already been pointed out, the lines with just @info; are meaningless. What are you trying to do there?
There's no need to put $n inside quotes. That line can just be writ1($n);, and I would probably just do foreach (@info) { writ1($_); }.
Finally, we have no idea whether the code works (that is, whether it's correct) because we have no idea what it's trying to accomplish -- there are no comments, nor have you provided anything to guide us as to what the inputs are (nickname and reply, but what's the context?). There's also no clue as to what the admin, writ1 or pm routines do.
Alex / talexb / Toronto
"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds
|