Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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";


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; }

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 rifling through the Monastery: (3)
As of 2020-09-29 22:32 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (153 votes). Check out past polls.