-
print ?perl
:wave: hi there,
I am new to Perl and have got a question..The following script gives me the number of the words I wanted..How can I tell the script to print all those words be printed/ listed( not just the number.. print all those 5 words begin in "b")thanks
My other question is that is it possible to use CCS within PERL?
--------------------------------------------------------------
#!/bin/perl
$text1 = "this is a red big book.There are 7 more books on the table.you can read them all. The first book is on using a computer. How old are you brother ? Are you 7 or seventeen ?";
@words = split(/ /,$text1);
foreach $wrd (@words){
if ($wrd =~ /\bb/){
$count1++;
}
if ($wrd =~ /book/){
$count2++;
}
}
print "there are <h3>$count1 </h3>words that begin ..b.\n";
print "There are <h3>$count2 </h3> \"book\" in the text1";
-
You could put the words on an array(s), then step through the array with a for loop and print each element of the array.
Are you new to Perl, or new to programming?
As to CSS in Perl: CSS is a HTML/XHTML/XML specific thing. It won't have an affect on a Perl script. If you are writing a Perl CGI script, then the CSS can be treated like the ML you are using. Your block of code is writing code for another machine to execute.
-
css and perl
okay thanks,
I mean we use HTML to define colors/size...to craete a html "form" within perl...and to locate this form or a guestbook text boxes we need css because it is easier in CSS
for example we use
print"<html><body>......</body></html>";in perl
but how can I write ...print "<style> #aaa{background-color:blue;......;}</style>"; does this work in perl?
thanks