Thursday, January 22, 2015

Perl Progam To Automate Blog Posts

  • $12.40 Monday
  • $8.40 Tuesday
  • $23.37 Wednesday
I am testing out the Perl program that I wrote, which will format my text for me, so I don't have to do it manually.

This parapraph should be a different color than the previous one, with the color having been chosen at random by the program.

I still haven't worked in the feature which will choose a different color than the previous paragraph, but, since the colors are random, that should rarely be a problem, as they should rarely repeat, and certainly shouldn't for 3 paragraphs in a row.

Here is the code; in its infant stage: 

#use 5.010;
#while (!eof) {

#$paragraph = *STANDARD_IN*;  --READS TILL ENCOUNTERING CARRIAGE RETURN (A  WHOLE PARAGRAPH)
#print '*span style="font-size: 175%"*'; --WRITES HTML TO ENLARGE TEXT
#@words = split / /, $paragraph; --BREAKS PARAGRAPH INTO INDIVIDUAL WORDS
#$x= @words; --COUNTS THOSE WORDS
#for ($j = 0; $j IS LESS THAN 3; $j++) { ---PRINTS FIRST 3 WORDS LARGER
#print $words[$j] . " ";
}
#print '* /span*'; --PRINTS CODE TO UNDO ENLARGEMENT

#print '*span style ="color: '; --CODE TO CHANGE  COLOR
#for ($c = 0; $c IS LESS THAN 6; $C++) { ---SELECTS 6 RANDOM HEX DIGITS (A..F)
#$color = int(rand 5) + 65; --MAKES SURE THEY ARE IN THE RANGE OF CAPITAL A...F
#$hex = pack "c", $color; ---CHANGES RANDOM NUMBER TO ALPHABET FOR HEXADECIMAL COLOR #ACDBFF, FORMAT
#print $hex; --WRITES THE COLOR TO USE
#}print '"(CLOSING BRACKET)*';
#$y = 3; ---STARTS AT THE 4TH (REGULAR SIZE) CHARACTER AND PRINTS REST OF PARAGRAPH
#while ($y IS LESS THAN $x) { ---$X IS TOTAL WORD COUNT FOR PARAGRAPH
#print $words [$y] . " ";
#$y++;
#}
#print '* /span** br/ *';
#} ---GOES TO GET NEXT PARAGRAPH "WHILE" THERE STILL ARE MORE

And

No comments:

Post a Comment

Comments Brighten My Life