FizzBuzzWhizz

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/usr/bin/perl

use strict;

die "Wrong argument number\n" if @ARGV != 3;

# print to file if you wish to
# open STDOUT, ">>", "fizzed.txt" or die "Can't write\n";

my ($fiz, $buz, $wiz) = @ARGV;

for(1..100){
	my $turned = my $fizzed = undef;
	{
		local $_ = $_;
		while( defined ){
			if (substr($_, 0, 1) eq $fiz){
				$fizzed = print "Fizz\n";
				last;
			}
			$_ = substr($_, 1);
		}
	}
	next if $fizzed;
	$turned = print "Fizz" if $_ % $fiz == 0;
	$turned = print "Buzz" if $_ % $buz == 0;
	$turned = print "Whizz" if $_ % $wiz == 0;
	print unless $turned;
	print "\n";
}