hi folks - i'm new!

Discussion in 'New Members Introduction' started by trekboy, Jul 9, 2007.

  1. trekboy

    trekboy New Member

    3
    0
    6
    anyone out there doing CIW Perl section 2 part b - lesson 12?

    can we discusss the last bit? sounds really confusing!

    :)
     
  2. Arroryn

    Arroryn we're all dooooooomed Moderator

    4,015
    193
    209
    Sorry, not doing that; have a search for the topic though, and see what you can find!

    Welcome to the forums :D
     
    Certifications: A+, N+, MCDST, 70-410, 70-411
    WIP: Modern Languages BA
  3. wizard

    wizard Petabyte Poster

    5,767
    42
    174
    Hi there and welcome 8)
     
    Certifications: SIA DS Licence
    WIP: A+ 2009
  4. Kitkatninja
    Highly Decorated Member Award 500 Likes Award

    Kitkatninja aka me, myself & I Moderator

    11,143
    559
    383
    Another Trekkie, welcome onboard :)

    -ken
     
    Certifications: MSc, PGDip, PGCert, BSc, HNC, LCGI, MBCS CITP, MCP, MCSA, MCSE, MCE, A+, N+, S+, Server+
    WIP: MSc Cyber Security
  5. BosonMichael
    Honorary Member Highly Decorated Member Award 500 Likes Award

    BosonMichael Yottabyte Poster

    19,183
    500
    414
    Welcome!
     
    Certifications: CISSP, MCSE+I, MCSE: Security, MCSE: Messaging, MCDST, MCDBA, MCTS, OCP, CCNP, CCDP, CCNA Security, CCNA Voice, CNE, SCSA, Security+, Linux+, Server+, Network+, A+
    WIP: Just about everything!
  6. Theprof

    Theprof Petabyte Poster

    4,607
    83
    211
    Welcome to CF.
     
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA
  7. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Hi and welcome to CF!

    I know Perl fairly well, but not the question (I haven't done CIW), so a bit more detail on your problem might help.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  8. Bluerinse
    Honorary Member

    Bluerinse Exabyte Poster

    8,878
    181
    256
    G'day and welcome to CF 8)
     
    Certifications: C&G Electronics - MCSA (W2K) MCSE (W2K)
  9. trekboy

    trekboy New Member

    3
    0
    6
    thanks for the reply!

    the course is slightly confusing, and I can't wait for the tutors (they take too long to repsond.............)

    anyway, the text is below. hopefully you can help by putting it in english!
    ____________________________________

    You are to write a Perl program that analyses text files to obtain statistics on their content. The program should operate as follows:

    1) When run, the program should check if an argument has been provided. If not, the program should prompt for, and accept input of, a filename from the keyboard.

    2) The filename, either passed as an argument or input from the keyboard, should be checked to ensure it is in MS-DOS format. The filename part should be no longer than 8 characters and must begin with a letter or underscore character followed by up to 7 letters, digits or underscore characters.
    The file extension should be optional, but if given is should be ".TXT (upper- or lowercase).

    For example:
    input.txt # valid
    inputfile.txt # invalid
    input. text # invalid
    testfile # valid

    If no extension if given, ".TXT" should be added to the end of the filename. So, for example, if "testfile" is input as the filename, this should become "testfile.TXT. If "input.txt” is entered, this should remain unchanged.

    3) If the filename provided is not of the correct format, the program should display a suitable error message and end at this point.

    4) The program should then check to see if the file exists using the filename provided. If ,. the file does not exist, a suitable error message should be displayed and the program should end at this point.

    5) Next, if the file exists but the file is empty, again a suitable error message should be displayed and the program should end.

    6) The file should be read and checked to display crude statistics on the number of characters, words, lines, sentences and paragraphs that are within the file.

    In producing the statistics you can assume the following:
    - the character count can include any whitespace and punctuation characters (i.e. it can include all characters in the file)
    - each word is separated by a space, tab or new line character (\n), except if the previous character was a space, tab or new line
    - each line is separated by a new line character
    - each sentence is ended by either a full stop, question mark or exclamation mark
    - a paragraph is ended by two consecutive new line characters
    ___________________________________

    see what I mean!!
     
  10. Sparky
    Highly Decorated Member Award 500 Likes Award

    Sparky Zettabyte Poster Moderator

    10,718
    543
    364
    Its been a long time since I had to write some code, my DB written in Visual Basic 6 (woohoo!) is still going strong from what I heard from the lad that took over a job a I had a few years ago.

    From the points you have listed.....
    Points 2-5 are all about validating the user input. You are basically checking the input from the user before you execute the search routine. For example if the user enters nothing and presses the enter key you would want a message box to display “You must enter a value” or something like that.

    Point 6 is all about collecting data and there are a few clues as well. Not sure if you get a string variable in Perl but basically you want to code a routine that will go through all the characters in the file and assess then. For each character you would add one to a character variable you have defined and for each full stop you would add one to a sentence variable.
    At the end of the file you can then output the results.

    Hopefully a code guru will be able to help as I am now officially a “network guy” :biggrin
     
    Certifications: MSc MCSE MCSA:M MCSA:S MCITP:EA MCTS(x5) MS-900 AZ-900 Security+ Network+ A+
    WIP: Microsoft Certs
  11. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Er - if you intend to use your cert when you get it then you will need to learn to read this sort of thing. IMHO the question is a model of clarity compared with the usual crap specs I get! :biggrin
    Should be easy - look up @ARGV
    This is testing your ability at pattern matching. IMHO pattern matching (aka regex) is one of the most powerful parts of Perl and renders quite complex stuff easily.

    Do you know your test operators?

    What about using the stat() function?
    Pattern matching plus the ability to write a loop is looked for here.

    If you are going to be serious about doing web stuff then you will *need* to get languages like Perl under your belt. A *lot* of stuff on the 'net uses Perl or its various equivalents to get the results desired.

    Harry.

    Edit - just realized which forum this is in - the mods may want to move this bit.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  12. Veteran's son

    Veteran's son Megabyte Poster

    915
    2
    55
    Hello and welcome!:)
     
    Certifications: A+
    WIP: N+
  13. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    Greetings. :)

    -Trip
     
    Certifications: A+ and Network+

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.