Skip to content

Instantly share code, notes, and snippets.

Created October 11, 2011 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/1277978 to your computer and use it in GitHub Desktop.
Save anonymous/1277978 to your computer and use it in GitHub Desktop.
#! /usr/bin/perl
use strict;
my $in=$ARGV[0];
my $res;
my $ver;
for $ver(1..$in){
$res="";
if ($ver % 3 == 0 || $ver % 5 == 0 ){
if ( $ver % 3 == 0 ){
$res="Fizz";
}
if ( $ver % 5 == 0 ){
$res.="Buzz";
}
} else {
$res=$ver;
}
print $res,"\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment