Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

better way to do this

Posted on 2001-06-10
2
Medium Priority
?
126 Views
Last Modified: 2010-03-05
for($i=1; $i<25; $i++)
 {
  print "a";

  if($i/12==int($i/12))
   {
    print "b";
   };

  if($i/24==int($i/24))
   {
    print "c";
   };

  sleep 3600;
 };
0
Comment
Question by:superquestions
2 Comments
 
LVL 8

Expert Comment

by:bebonham
ID: 6173736
try this:


for(1..125)
{
if($_%12==0)
{print "b";
print "\n$_\n";
if($_%24==0){
print "c";
print "\n$_\n";
}}
}



Bob


0
 
LVL 85

Accepted Solution

by:
ozo earned 300 total points
ID: 6174434
$|=1;
for $i ( 1..24 ){
  print "a",$i%12?"":"b",!($i%24)&&"c";
  sleep 3600;
}
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question