# where to put what?

• Beginner
• Posts: 51

3+ Months Ago

Code: [ Select ]
sub IsLong {
my(\$thestr) = pop(@_);
if(length(\$thestr) > 10) { return("this is long") }
else { return("this is short") } };

print &IsLong;
1. sub IsLong {
2. my(\$thestr) = pop(@_);
3. if(length(\$thestr) > 10) { return("this is long") }
4. else { return("this is short") } };
5. print &IsLong;

i got this script online, its the part i need but i want to add a part to it so it lets the user enter a sentance like this

Code: [ Select ]
print "this will tell you how many letters your sentance has compared to

10 put in a sentance: ";

\$sentance = <stdin>;
chomp (\$sentance);
1. print "this will tell you how many letters your sentance has compared to
2. 10 put in a sentance: ";
3. \$sentance = <stdin>;
4. chomp (\$sentance);
you see i have all the parts to make this code complete however i do not know exactly where to put everything. can anyone help me?
• Guru
• Posts: 1259
• Loc: ./

3+ Months Ago

Code: [ Select ]
print "this will tell you how many letters your sentance has compared to 10.\n";
print "Put in a sentance: ";

\$sentance = <stdin>;
chomp(\$sentance);

&isLong;

sub isLong {
if(length(\$sentance) > 10){
print "this is long\n";
} else {
print "this is short\n";
}
}
1. print "this will tell you how many letters your sentance has compared to 10.\n";
2. print "Put in a sentance: ";
3. \$sentance = <stdin>;
4. chomp(\$sentance);
5. &isLong;
6. sub isLong {
7.     if(length(\$sentance) > 10){
8.         print "this is long\n";
9.     } else {
10.         print "this is short\n";
11.     }
12. }

Happy Coding
This

## Post Information

• Total Posts in this topic: 2 posts
• Users browsing this forum: No registered users and 48 guests
• You cannot post new topics in this forum
• You cannot reply to topics in this forum
• You cannot edit your posts in this forum
• You cannot delete your posts in this forum
• You cannot post attachments in this forum

© 1998-2015. Ozzu® is a registered trademark of Unmelted, LLC.