Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2013
    Posts
    2

    Unanswered: Perl Script...help!

    Hey guys, I'm new to the forum and to Perl and looking for some help. I'm a "shade tree programmer", have some experience here and there with other types of scripts.

    I'm trying to write a perl script to look at a log file for a particular line "Total TestCases: 7 (0 failed)". If this doesn't exist (meaning I have more than 0 failed, I want it to email me stating "test xyz failed".

    I havent made it far...have this, and it's not even close. Oh and it's on a windows machine using ActivePerl.

    #!C:\Perl64\bin\perl

    open (LOGFILE, 'C:\DAL\QA\DALQAReport.txt');

    while (<LOGFILE>) {
    chomp;
    print "$_\n";;
    }
    close (LOGFILE);

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Apr 2013
    Posts
    2
    thats helps on the email portion...but im looking for some help on syntax to locate that string or if it dont exist

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    $absent = index(do { local $/; <>}, "Total TestCases: 7 (0 failed)") < 0;
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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