Results 1 to 3 of 3

Thread: print ?perl

  1. #1

    Thread Starter
    Fanatic Member merhaba's Avatar
    Join Date
    Sep 2002
    Location
    Istanbul,Bartin-Gallipoli(Gelibolu-Canakkale)
    Posts
    601

    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";

  2. #2
    Addicted Member
    Join Date
    Sep 2002
    Location
    Durham, NC, US
    Posts
    218
    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.
    Travis, Kung Foo Journeyman

    Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
    Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    OSS: Mozilla, MySQL (Manual)

  3. #3

    Thread Starter
    Fanatic Member merhaba's Avatar
    Join Date
    Sep 2002
    Location
    Istanbul,Bartin-Gallipoli(Gelibolu-Canakkale)
    Posts
    601

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width