diff --git a/scripts/quitrand.pl b/scripts/quitrand.pl index cfa1b3875..71784bfc6 100644 --- a/scripts/quitrand.pl +++ b/scripts/quitrand.pl @@ -6,7 +6,7 @@ use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.00"; +$VERSION = "1.01"; %IRSSI = ( authors => 'Fernando J. Pereda', contact => 'ferdy@ferdyx.org', @@ -20,21 +20,17 @@ sub cmd_quit { my ($data, $server, $channel) = @_; - open(f,"<",$quitfile); - my @contenido = ; - close(f); + open(my $fh,"<",$quitfile); + my @contenido = <$fh>; + close($fh); - my $numlines = 0; - - foreach my $nada (@contenido) { - $numlines++; - } + my $numlines = 0+@contenido; my $line = int(rand($numlines))+1; my $quitmsg = "[IRSSI] ".$contenido[$line]; - chop($quitmsg); + chomp($quitmsg); print($quitmsg);