1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

hi folks - i'm new!

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

  1. trekboy

    trekboy New Member

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

    can we discusss the last bit? sounds really confusing!

  2. Arroryn
    Honorary Member

    Arroryn we're all dooooooomed

    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

    Hi there and welcome 8)
    Certifications: SIA DS Licence
    WIP: A+ 2009
  4. wagnerk
    Highly Decorated Member Award

    wagnerk aka kitkatninja Moderator

    Another Trekkie, welcome onboard :)

    Certifications: CITP, PGDip, BSc, HNC, LCGI, PTLLS, MCT, MCITP, MCTS, MCSE, MCSA:M, MCSA, MCDST, MCP, MTA, MCAS, MOS (Master), A+, N+, S+, ACA, VCA, etc... & 2nd Degree Black Belt
    WIP: MSc in Tech Management
  5. BosonMichael
    Highly Decorated Member Award

    BosonMichael Yottabyte Poster

    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 Premium Member

    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
  7. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    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.

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

    Bluerinse Exabyte Poster

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

    trekboy New Member

    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

    Sparky Zettabyte Poster Moderator

    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) Security+ Network+ A+
    WIP: Office 365, Server 2016, CEH
  11. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    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.


    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

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

    tripwire45 Zettabyte Poster

    Greetings. :)

    Certifications: A+ and Network+

Share This Page