CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Stupid question from a beginner.... Please answer....

 



bunnyman7
New User

Apr 24, 2009, 6:36 AM

Post #1 of 5 (727 views)
Stupid question from a beginner.... Please answer.... Can't Post

Write a Perl program that counts the lines on STDIN that contain an 'a' (case-sensitive) that is neither the first nor the last character on the line.

If you have any ideas of what i need please answer...


ichi
User

Apr 24, 2009, 8:41 AM

Post #2 of 5 (719 views)
Re: [bunnyman7] Stupid question from a beginner.... Please answer.... [In reply to] Can't Post


In Reply To
If you have any ideas of what i need please answer...

you need to ....... read the docs? or revise your lessons? to count things, use a counter and a loop.


KevinR
Veteran


Apr 24, 2009, 9:53 AM

Post #3 of 5 (717 views)
Re: [bunnyman7] Stupid question from a beginner.... Please answer.... [In reply to] Can't Post


In Reply To
Write a Perl program that counts the lines on STDIN that contain an 'a' (case-sensitive) that is neither the first nor the last character on the line.

If you have any ideas of what i need please answer...


If you want help with your lessons post what code you have written to try and solve your requirements, even if they do not work.
-------------------------------------------------


verb
Novice


Apr 27, 2009, 1:25 AM

Post #4 of 5 (698 views)
Re: [KevinR] Stupid question from a beginner.... Please answer.... [In reply to] Can't Post

$i=1;
$count=0;
while($i>0){
$i++;
$count += () = <STDIN> =~ /a/g;
print $count,"\n";
}

Sly

$count=0;
RESET:while(1){

$count += () = <STDIN> =~ /a/g;
print $count,"\n";
next RESET;
}

In Reply To


=============================
SQL, NoSQL or SomeSQL?

(This post was edited by verb on Apr 27, 2009, 2:28 AM)


KevinR
Veteran


Apr 27, 2009, 10:39 AM

Post #5 of 5 (677 views)
Re: [verb] Stupid question from a beginner.... Please answer.... [In reply to] Can't Post


In Reply To
$i=1;
$count=0;
while($i>0){
$i++;
$count += () = <STDIN> =~ /a/g;
print $count,"\n";
}

Sly

$count=0;
RESET:while(1){

$count += () = <STDIN> =~ /a/g;
print $count,"\n";
next RESET;
}

In Reply To


That was rude.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives