|
-
Feb 3rd, 2004, 04:28 AM
#1
Thread Starter
Fanatic Member
print ?perl
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";
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|