Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Blob Maker

by legolas (Acolyte)
on Aug 21, 2002 at 03:17 UTC ( #191647=sourcecode: print w/ replies, xml ) Need Help??

Category: Fun Stuff
Author/Contact Info Kevin Cohe
Description: This is a simple program that draws squares out of asterikses. I did it basically to learn about strings and loops. Nothing spectacular, but a fun program nonetheless.
#!/usr/bin/perl -w

print "Welcome to blob maker V1.1\n";

print "all you need to do is input the size of your 


print "and the computers built in gene sequencer ;-) will 

make your blob\n\n\n"; 

print "Input your blob's height\n";


print "Input your blob's width\n";


print "input blob message\n";



print "$msg" x $width . "\n";



Comment on Blob Maker
Download Code
Replies are listed 'Best First'.
Re: Blob Maker
by blakem (Monsignor) on Aug 21, 2002 at 05:24 UTC
    That certainly is a good start, but what happens to your loop if I enter a negative value for the height parameter?


Re: Blob Maker
by Anonymous Monk on Oct 07, 2006 at 18:37 UTC
    I have edited the message, improved readability, and corrected the negative value flaw; the only trouble is that it warns if there's a non-integer argument :(. I don't know how to correct this.
    #!/usr/bin/perl use warnings; use strict; print "Welcome to blob maker V1.2\n"; print("Input your blob's height: "); chomp(my $height=<STDIN>); $height=int($height); die("Invalid argument.\n") if ($height < 1); print("Input your blob's width: "); chomp(my $width=<STDIN>); $width=int($width); die("Invalid argument.\n") if($width < 1); print("Input blob message: "); chomp(my $msg=<STDIN>); print("\n"); while ($height > 0 ){ print("$msg" x $width . "\n"); --$height; }

Back to Code Catacombs

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://191647]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-11-29 18:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (752 votes), past polls