Loading ...
Sorry, an error occurred while loading the content.

please help

Expand Messages
  • tam@lvcm.com
    I downloaded active perl and installed it on my computer running win 98. It then says to go to the DOS prompt. My prompt says c: windows . I type
    Message 1 of 13 , Sep 12, 2000
    • 0 Attachment
      I downloaded active perl and installed it on my computer running win
      98. It then says to go to the DOS prompt. My prompt says
      c:\windows>. I type c:\windows>c:\perl -v and it just takes me back
      to the c:\windows> prompt. What am I doing wrong? How can I tell if
      perl is installed correctly? Thanks...
    • u1810
      Can some one please look at my code ad see what I am doing wrong. For some reason it is not working when there is less then three running. if you look at the
      Message 2 of 13 , Apr 5, 2002
      • 0 Attachment
        Can some one please look at my code ad see what I am doing wrong.

        For some reason it is not working when there is less then three
        running. if you look at the log file it is reading you will see that
        only 2 are running and it did not send an email.

        CHK_SBL_PRD WorkMon 97015 409 Running
        CHK_SBL_PRD WorkMon 91757 457 Running
        CHK_SBL_PRD WorkMon 27241 Completed
        CHK_SBL_PRD WorkMon 27240 Completed
        CHK_SBL_PRD WorkMon 27239 Exited with error please
        help

        5 rows returned.


        Thank you again.

        Lance



        #open a file with the filehandle
        open WORKFLOW, "+<..\\..\\workflow.txt" or die "Cannot open Workflow
        $!\n";
        $counting_runners = 0;
        while (<INFILE>){
        if ($_=~m/running/i){
        $counting_runners++;
        use Mail::Sendmail; #Send and
        email if there are errors
        %mail = ( To => '2142445931@...',
        From => 'support@...',
        Subject => '',
        Message => 'Work Flow ended: '.substr($line, 95, 17)
        );
        sendmail(%mail) or die $Mail::Sendmail::error;
        print "OK. Log says:\n", $Mail::Sendmail::log;

        }
        if ($counting_runners == 3) {
        open (APPEND, ">>Moniterlog.log") or die "$! error
        trying to append";
        ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
        =localtime(time);
        %weekday=(
        "0"=>"Sunday",
        "1"=>"Monday",
        "2"=>"Tueday",
        "3"=>"Wednesday",
        "4"=>"Thursday",
        "5"=>"Friday",
        "6"=>"Saturday",
        "7"=>"Sunday",
        );
        if ($hour> 12)
        {
        print APPEND "Successfully Completed Work
        Flow Moniter $hour:$min\n";
        print APPEND 'Substring: '.substr($_, 42, 7);
        print APPEND "\n";
        print APPEND 'Substring: '.substr($nextline,
        42, 7);
        print APPEND "\n";
        print APPEND "--------------------------------
        --------------------\n";
        }
        else
        {
        print APPEND "Successfully Completed Work Flow Moniter
        $hour:$min\n";
        print APPEND 'Substring: '.substr($_, 42, 7);
        print APPEND "\n";
        print APPEND 'Substring: '.substr($nextline,
        42, 7);
        print APPEND "\n";
        print APPEND "--------------------------------
        --------------------\n";
        }
        last;
        }
      • bklchu
        Hi All I am a university student and working on a research project. I need to handle lots of data, hence I have to learn the Perl program to help me. And the
        Message 3 of 13 , Aug 29, 2005
        • 0 Attachment
          Hi All
          I am a university student and working on a research project.
          I need to handle lots of data, hence I have to learn the Perl program
          to help me. And the deadline is getting very close :-(
          I would be very grateful if any of you can kindly give me a hand on
          this.

          Please let me explain my problems:

          The data file (samintc.txt) contains the share prices of Intel in the
          last 25 days, and each row contains 5 elements: date, open price,
          high price, low price, and closing price.

          My program seems to be able to read the data and print them out
          correctly. But I have problem to achieve the following:

          1) I need to find out the date when the highest number occurred in
          the "High" coulumn (the third column) for the first 10 rows, ie from
          25-jul to 5-Aug. The correct answer is 27.66 happened on 3-Aug-05.

          How do I sort the third column (= "high" field") for the first 10
          rows and be able to gives the date (ie. 3-Aug-05) as the correct
          answer?

          2) I need to construct a 3-day moving averages for the closing price.
          Hence, I need to add another field called "moving_average", where the
          first 2 rows will be blank and on the third days onward, we can
          calculate the moving average to assign to them. Please see the moving
          average example at the bottom of this message.


          Thanks very much in advanced, and I do really appreciate your
          kind help.


          Best Regards
          Barry



          Data file: samintc.txt

          25-Jul-05, 26.85, 26.91, 26.43, 26.52
          26-Jul-05, 26.66, 27.00, 26.53, 26.89
          27-Jul-05, 26.85, 27.13, 26.62, 27.06
          28-Jul-05, 27.07, 27.43, 26.96, 27.34
          29-Jul-05, 27.29, 27.34, 27.14, 27.14
          1-Aug-05, 27.24, 27.38, 27.10, 27.11
          2-Aug-05, 27.19, 27.63, 27.15, 27.56
          3-Aug-05, 27.47, 27.66, 27.45, 27.64
          4-Aug-05, 27.48, 27.55, 27.01, 27.01
          5-Aug-05, 27.02, 27.09, 26.63, 26.77
          8-Aug-05, 26.87, 26.98, 26.00, 26.71
          9-Aug-05, 26.80, 27.19, 26.74, 26.90
          10-Aug-05, 26.98, 27.42, 26.79, 26.88
          11-Aug-05, 26.52, 26.82, 26.36, 26.82
          12-Aug-05, 26.42, 26.55, 26.18, 26.31
          15-Aug-05, 26.25, 26.67, 26.23, 26.53
          16-Aug-05, 26.18, 26.28, 25.97, 26.00
          17-Aug-05, 26.06, 26.18 , 25.95, 26.09
          18-Aug-05, 25.97, 26.10, 25.81, 25.88
          19-Aug-05, 25.94, 25.98, 25.61, 25.65
          22-Aug-05, 25.75, 26.23, 25.74, 26.06
          23-Aug-05, 26.21, 26.28, 25.71, 25.72
          24-Aug-05, 25.67, 26.09, 25.51, 25.53
          25-Aug-05, 25.47 , 25.66, 25.42, 25.46
          26-Aug-05, 25.48, 25.60, 25.31, 25.41


          #!/usr/bin/perl -w
          # use sample.txt
          #this file = dataintl.pl

          open(FILE, "intl.txt" );
          @fieldlist = qw(date open high low close);

          while (<FILE>) {
          @data{@fieldlist} = split(/,/, $_, scalar @fieldlist);
          foreach (@fieldlist) {
          print($data{$_});
          }
          }
          close(FILE);



          OUTPUT:

          25-Jul-05 26.85 26.91 26.43 26.52
          26-Jul-05 26.66 27.00 26.53 26.89
          27-Jul-05 26.85 27.13 26.62 27.06
          28-Jul-05 27.07 27.43 26.96 27.34
          29-Jul-05 27.29 27.34 27.14 27.14
          1-Aug-05 27.24 27.38 27.10 27.11
          2-Aug-05 27.19 27.63 27.15 27.56
          3-Aug-05 27.47 27.66 27.45 27.64
          4-Aug-05 27.48 27.55 27.01 27.01
          5-Aug-05 27.02 27.09 26.63 26.77
          8-Aug-05 26.87 26.98 26.00 26.71
          9-Aug-05 26.80 27.19 26.74 26.90
          10-Aug-05 26.98 27.42 26.79 26.88
          11-Aug-05 26.52 26.82 26.36 26.82
          12-Aug-05 26.42 26.55 26.18 26.31
          15-Aug-05 26.25 26.67 26.23 26.53
          16-Aug-05 26.18 26.28 25.97 26.00
          17-Aug-05 26.06 26.18 25.95 26.09
          18-Aug-05 25.97 26.10 25.81 25.88
          19-Aug-05 25.94 25.98 25.61 25.65
          22-Aug-05 25.75 26.23 25.74 26.06
          23-Aug-05 26.21 26.28 25.71 25.72
          24-Aug-05 25.67 26.09 25.51 25.53
          25-Aug-05 25.47 25.66 25.42 25.46
          26-Aug-05 25.48 25.60 25.31 25.41




          adding moving average

          Date Open High Low Close moving_average
          25-Jul-05 26.85 26.91 26.43 26.52
          26-Jul-05 26.66 27.00 26.53 26.89
          27-Jul-05 26.85 27.13 26.62 27.06 26.82
          28-Jul-05 27.07 27.43 26.96 27.34 27.10
          29-Jul-05 27.29 27.34 27.14 27.14 27.18
          1-Aug-05 27.24 27.38 27.10 27.11 27.20
          2-Aug-05 27.19 27.63 27.15 27.56 27.27
          3-Aug-05 27.47 27.66 27.45 27.64 27.44
          4-Aug-05 27.48 27.55 27.01 27.01 27.40
          5-Aug-05 27.02 27.09 26.63 26.77 27.14
          8-Aug-05 26.87 26.98 26.00 26.71 26.83
          9-Aug-05 26.80 27.19 26.74 26.90 26.79
          10-Aug-05 26.98 27.42 26.79 26.88 26.83
          11-Aug-05 26.52 26.82 26.36 26.82 26.87
          12-Aug-05 26.42 26.55 26.18 26.31 26.67
          15-Aug-05 26.25 26.67 26.23 26.53 26.55
          16-Aug-05 26.18 26.28 25.97 26.00 26.28
          17-Aug-05 26.06 26.18 25.95 26.09 26.21
          18-Aug-05 25.97 26.10 25.81 25.88 25.99
          19-Aug-05 25.94 25.98 25.61 25.65 25.87
          22-Aug-05 25.75 26.23 25.74 26.06 25.86
          23-Aug-05 26.21 26.28 25.71 25.72 25.81
          24-Aug-05 25.67 26.09 25.51 25.53 25.77
          25-Aug-05 25.47 25.66 25.42 25.46 25.57
          26-Aug-05 25.48 25.60 25.31 25.41 25.47
        • merlyn@stonehenge.com
          ... bklchu I am a university student and working on a research project. Then you should be using your instructor and classmates for help, not this mailing
          Message 4 of 13 , Aug 29, 2005
          • 0 Attachment
            >>>>> "bklchu" == bklchu <bklchu@...> writes:

            bklchu> I am a university student and working on a research project.

            Then you should be using your instructor and classmates for help,
            not this mailing list.

            bklchu> How do I sort the third column (= "high" field") for the first 10
            bklchu> rows and be able to gives the date (ie. 3-Aug-05) as the correct
            bklchu> answer?

            If you can't do that, but it's part of the exercise question, either
            you have failed, or the instructor has failed. In either case, asking
            how to do that here is a waste of the university system for which you
            are paying.

            bklchu> 2) I need to construct a 3-day moving averages for the closing price.
            bklchu> Hence, I need to add another field called "moving_average", where the
            bklchu> first 2 rows will be blank and on the third days onward, we can
            bklchu> calculate the moving average to assign to them. Please see the moving
            bklchu> average example at the bottom of this message.

            Again, you will fail this class, unless you go back to the instructor
            and ask this question. Maybe you should fail the class anyway, for
            attempting to cheat.

            --
            Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
            <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
            Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
            See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
          • bklchu
            Hi I think I need to clarify that I am a university student, but I have not done any computer course before. I think you are being very unfair to me, by
            Message 5 of 13 , Aug 29, 2005
            • 0 Attachment
              Hi
              I think I need to clarify that I am a university student, but I have
              not done any computer course before. I think you are being very
              unfair to me, by assuming me asking help for my Perl course
              work here, which is NOT the case!!

              I have never learn any programing language until 2
              months ago. I need to do a research project that
              need to handle lots of data, hence I need to study the
              Perl language all by myself. I read through the
              "Begining Perl" book and have 2 other Perl books to
              read, but it seems I could not find the answer
              that I want, or something that I must have difficulty
              in understanding. The deadline for my project is
              approaching and that's why I am so desprite to seek
              help from here.

              Regards
              Barry





              --- In perl-beginner@yahoogroups.com, merlyn@s... wrote:
              > >>>>> "bklchu" == bklchu <bklchu@y...> writes:
              >
              > bklchu> I am a university student and working on a research project.
              >
              > Then you should be using your instructor and classmates for help,
              > not this mailing list.
              >
              > bklchu> How do I sort the third column (= "high" field") for the
              first 10
              > bklchu> rows and be able to gives the date (ie. 3-Aug-05) as the
              correct
              > bklchu> answer?
              >
              > If you can't do that, but it's part of the exercise question, either
              > you have failed, or the instructor has failed. In either case,
              asking
              > how to do that here is a waste of the university system for which
              you
              > are paying.
              >
              > bklchu> 2) I need to construct a 3-day moving averages for the
              closing price.
              > bklchu> Hence, I need to add another field called "moving_average",
              where the
              > bklchu> first 2 rows will be blank and on the third days onward,
              we can
              > bklchu> calculate the moving average to assign to them. Please see
              the moving
              > bklchu> average example at the bottom of this message.
              >
              > Again, you will fail this class, unless you go back to the
              instructor
              > and ask this question. Maybe you should fail the class anyway, for
              > attempting to cheat.
              >
              > --
              > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
              777 0095
              > <merlyn@s...> <URL:http://www.stonehenge.com/merlyn/>
              > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
              > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
              training!
            • bklchu
              Hi All By the way, someone has already helped me on my questions. I sincerely and really appreciated his/her help. They pointed me to the right direction.
              Message 6 of 13 , Aug 29, 2005
              • 0 Attachment
                Hi All
                By the way, someone has already helped me on my questions.
                I sincerely and really appreciated his/her help.
                They pointed me to the right direction.
                Thank you again for your help.

                Best Regards
                Barry


                --- In perl-beginner@yahoogroups.com, "bklchu" <bklchu@y...> wrote:
                > Hi
                > I think I need to clarify that I am a university student, but I
                have
                > not done any computer course before. I think you are being very
                > unfair to me, by assuming me asking help for my Perl course
                > work here, which is NOT the case!!
                >
                > I have never learn any programing language until 2
                > months ago. I need to do a research project that
                > need to handle lots of data, hence I need to study the
                > Perl language all by myself. I read through the
                > "Begining Perl" book and have 2 other Perl books to
                > read, but it seems I could not find the answer
                > that I want, or something that I must have difficulty
                > in understanding. The deadline for my project is
                > approaching and that's why I am so desprite to seek
                > help from here.
                >
                > Regards
                > Barry
                >
                >
                >
                >
                >
                > --- In perl-beginner@yahoogroups.com, merlyn@s... wrote:
                > > >>>>> "bklchu" == bklchu <bklchu@y...> writes:
                > >
                > > bklchu> I am a university student and working on a research
                project.
                > >
                > > Then you should be using your instructor and classmates for help,
                > > not this mailing list.
                > >
                > > bklchu> How do I sort the third column (= "high" field") for the
                > first 10
                > > bklchu> rows and be able to gives the date (ie. 3-Aug-05) as the
                > correct
                > > bklchu> answer?
                > >
                > > If you can't do that, but it's part of the exercise question,
                either
                > > you have failed, or the instructor has failed. In either case,
                > asking
                > > how to do that here is a waste of the university system for which
                > you
                > > are paying.
                > >
                > > bklchu> 2) I need to construct a 3-day moving averages for the
                > closing price.
                > > bklchu> Hence, I need to add another field
                called "moving_average",
                > where the
                > > bklchu> first 2 rows will be blank and on the third days onward,
                > we can
                > > bklchu> calculate the moving average to assign to them. Please
                see
                > the moving
                > > bklchu> average example at the bottom of this message.
                > >
                > > Again, you will fail this class, unless you go back to the
                > instructor
                > > and ask this question. Maybe you should fail the class anyway,
                for
                > > attempting to cheat.
                > >
                > > --
                > > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1
                503
                > 777 0095
                > > <merlyn@s...> <URL:http://www.stonehenge.com/merlyn/>
                > > Perl/Unix/security consulting, Technical writing, Comedy, etc.
                etc.
                > > See PerlTraining.Stonehenge.com for onsite and open-enrollment
                Perl
                > training!
              • YogS
                Hello If you are short of time, then instead of Perl, you can use Ms-Excel. On excel, this job would hardly take 1 min. Regards YogS ... [Non-text portions of
                Message 7 of 13 , Aug 30, 2005
                • 0 Attachment
                  Hello

                  If you are short of time, then instead of Perl, you can use Ms-Excel. On
                  excel, this job would hardly take 1 min.

                  Regards
                  YogS


                  On 8/30/05, bklchu <bklchu@...> wrote:
                  >
                  > Hi
                  > I think I need to clarify that I am a university student, but I have
                  > not done any computer course before. I think you are being very
                  > unfair to me, by assuming me asking help for my Perl course
                  > work here, which is NOT the case!!
                  >
                  > I have never learn any programing language until 2
                  > months ago. I need to do a research project that
                  > need to handle lots of data, hence I need to study the
                  > Perl language all by myself. I read through the
                  > "Begining Perl" book and have 2 other Perl books to
                  > read, but it seems I could not find the answer
                  > that I want, or something that I must have difficulty
                  > in understanding. The deadline for my project is
                  > approaching and that's why I am so desprite to seek
                  > help from here.
                  >
                  > Regards
                  > Barry
                  >
                  >
                  >
                  >
                  >
                  > --- In perl-beginner@yahoogroups.com, merlyn@s... wrote:
                  > > >>>>> "bklchu" == bklchu <bklchu@y...> writes:
                  > >
                  > > bklchu> I am a university student and working on a research project.
                  > >
                  > > Then you should be using your instructor and classmates for help,
                  > > not this mailing list.
                  > >
                  > > bklchu> How do I sort the third column (= "high" field") for the
                  > first 10
                  > > bklchu> rows and be able to gives the date (ie. 3-Aug-05) as the
                  > correct
                  > > bklchu> answer?
                  > >
                  > > If you can't do that, but it's part of the exercise question, either
                  > > you have failed, or the instructor has failed. In either case,
                  > asking
                  > > how to do that here is a waste of the university system for which
                  > you
                  > > are paying.
                  > >
                  > > bklchu> 2) I need to construct a 3-day moving averages for the
                  > closing price.
                  > > bklchu> Hence, I need to add another field called "moving_average",
                  > where the
                  > > bklchu> first 2 rows will be blank and on the third days onward,
                  > we can
                  > > bklchu> calculate the moving average to assign to them. Please see
                  > the moving
                  > > bklchu> average example at the bottom of this message.
                  > >
                  > > Again, you will fail this class, unless you go back to the
                  > instructor
                  > > and ask this question. Maybe you should fail the class anyway, for
                  > > attempting to cheat.
                  > >
                  > > --
                  > > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
                  > 777 0095
                  > > <merlyn@s...> <URL:http://www.stonehenge.com/merlyn/>
                  > > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
                  > > See PerlTraining.Stonehenge.com <http://PerlTraining.Stonehenge.com> for
                  > onsite and open-enrollment Perl
                  > training!
                  >
                  >
                  >
                  >
                  > Unsubscribing info is here:
                  > http://help.yahoo.com/help/us/groups/groups-32.html
                  >
                  >
                  > ------------------------------
                  > YAHOO! GROUPS LINKS
                  >
                  >
                  > - Visit your group "perl-beginner<http://groups.yahoo.com/group/perl-beginner>"
                  > on the web.
                  > - To unsubscribe from this group, send an email to:
                  > perl-beginner-unsubscribe@yahoogroups.com<perl-beginner-unsubscribe@yahoogroups.com?subject=Unsubscribe>
                  > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                  > Service <http://docs.yahoo.com/info/terms/>.
                  >
                  >
                  > ------------------------------
                  >


                  [Non-text portions of this message have been removed]
                • dhageuk
                  i have the following code: open filehandle, $somefile ; while ( ) { my $line = $_; if ($line =~ /^ -+$/) { $cgroup = $1; next; } if ($cgroup
                  Message 8 of 13 , Dec 22, 2010
                  • 0 Attachment
                    i have the following code:

                    open filehandle, "$somefile";
                    while (<filehandle>) {
                    my $line = $_;
                    if ($line =~ /^<(.*)>-+$/) {
                    $cgroup = $1;
                    next;
                    }
                    if ($cgroup eq 'FOOD EXPENSES') {}

                    which attempts to open a file which contains:

                    <FOOD EXPENSES>-----------
                    some data...
                    <UTILITY EXPENSES>--------
                    some data...

                    However, it was not able to find the FOOD EXPENSES. can someone tell me what is wrong with my code
                  • Rob Richardson
                    I can t answer your question, but I do have a suggestion: Please use a descriptive subject. Many members see Please Help and assume it s another appeal
                    Message 9 of 13 , Dec 22, 2010
                    • 0 Attachment
                      I can't answer your question, but I do have a suggestion: Please use
                      a descriptive subject. Many members see "Please Help" and assume it's
                      another appeal from a Nigerian wanna-be millionaire or somebody who
                      got mugged in England.

                      RobR, group moderator
                    • Karl Kaufman
                      How do you know it wasn t able to find the FOOD EXPENSES header without testing for it? (i.e. you re not doing anything in the script to verify whether the
                      Message 10 of 13 , Dec 22, 2010
                      • 0 Attachment
                        How do you know it wasn't able to find the 'FOOD EXPENSES' header without testing for it? (i.e. you're not doing anything in the script to verify whether the header was recognized) I added a print statement within the empty braces ({}) and it seemed to work fine.


                        ----- Original Message -----
                        From: dhageuk
                        To: perl-beginner@yahoogroups.com
                        Sent: Wednesday, December 22, 2010 4:13 AM
                        Subject: [PBML] please help



                        i have the following code:

                        open filehandle, "$somefile";
                        while (<filehandle>) {
                        my $line = $_;
                        if ($line =~ /^<(.*)>-+$/) {
                        $cgroup = $1;
                        next;
                        }
                        if ($cgroup eq 'FOOD EXPENSES') {}

                        which attempts to open a file which contains:

                        <FOOD EXPENSES>-----------
                        some data...
                        <UTILITY EXPENSES>--------
                        some data...

                        However, it was not able to find the FOOD EXPENSES. can someone tell me what is wrong with my code





                        [Non-text portions of this message have been removed]
                      • dhageuk
                        i forgot to tell that on windows it is working. but on ubuntu 10 it is not. i tried debugging and was not able to find it.
                        Message 11 of 13 , Dec 22, 2010
                        • 0 Attachment
                          i forgot to tell that on windows it is working. but on ubuntu 10 it is not. i tried debugging and was not able to find it.

                          --- In perl-beginner@yahoogroups.com, "Karl Kaufman" <krkweb@...> wrote:
                          >
                          > How do you know it wasn't able to find the 'FOOD EXPENSES' header without testing for it? (i.e. you're not doing anything in the script to verify whether the header was recognized) I added a print statement within the empty braces ({}) and it seemed to work fine.
                          >
                          >
                          > ----- Original Message -----
                          > From: dhageuk
                          > To: perl-beginner@yahoogroups.com
                          > Sent: Wednesday, December 22, 2010 4:13 AM
                          > Subject: [PBML] please help
                          >
                          >
                          >
                          > i have the following code:
                          >
                          > open filehandle, "$somefile";
                          > while (<filehandle>) {
                          > my $line = $_;
                          > if ($line =~ /^<(.*)>-+$/) {
                          > $cgroup = $1;
                          > next;
                          > }
                          > if ($cgroup eq 'FOOD EXPENSES') {}
                          >
                          > which attempts to open a file which contains:
                          >
                          > <FOOD EXPENSES>-----------
                          > some data...
                          > <UTILITY EXPENSES>--------
                          > some data...
                          >
                          > However, it was not able to find the FOOD EXPENSES. can someone tell me what is wrong with my code
                          >
                          >
                          >
                          >
                          >
                          > [Non-text portions of this message have been removed]
                          >
                        • Karl Kaufman
                          as a quick test, you might try loosening-up your regular expression, removing the end-of-record anchoring. (remove the $ ) ... I expect anchoring to the
                          Message 12 of 13 , Dec 23, 2010
                          • 0 Attachment
                            as a quick test, you might try loosening-up your regular expression, removing the end-of-record anchoring. (remove the '$')

                            > if ($line =~ /^<(.*)>-+/) {

                            I expect anchoring to the beginning of the line and looking for the trailing dashes should be sufficient to ident the header records, ya? (I'm wondering if failing to "chop" the end-of-line whitespace causes differing behaviors between Windows and Ubuntu10.)

                            Another test of the above would be to add a whitespace consideration to the regular expression, allowing you to keep the end-of-record anchoring...

                            > if ($line =~ /^<(.*)>-+\s*$/) {




                            ----- Original Message -----
                            From: dhageuk
                            To: perl-beginner@yahoogroups.com
                            Sent: Wednesday, December 22, 2010 5:41 PM
                            Subject: Re: [PBML] please help



                            i forgot to tell that on windows it is working. but on ubuntu 10 it is not. i tried debugging and was not able to find it.

                            --- In perl-beginner@yahoogroups.com, "Karl Kaufman" <krkweb@...> wrote:
                            >
                            > How do you know it wasn't able to find the 'FOOD EXPENSES' header without testing for it? (i.e. you're not doing anything in the script to verify whether the header was recognized) I added a print statement within the empty braces ({}) and it seemed to work fine.
                            >
                            >
                            > ----- Original Message -----
                            > From: dhageuk
                            > To: perl-beginner@yahoogroups.com
                            > Sent: Wednesday, December 22, 2010 4:13 AM
                            > Subject: [PBML] please help
                            >
                            >
                            >
                            > i have the following code:
                            >
                            > open filehandle, "$somefile";
                            > while (<filehandle>) {
                            > my $line = $_;
                            > if ($line =~ /^<(.*)>-+$/) {
                            > $cgroup = $1;
                            > next;
                            > }
                            > if ($cgroup eq 'FOOD EXPENSES') {}
                            >
                            > which attempts to open a file which contains:
                            >
                            > <FOOD EXPENSES>-----------
                            > some data...
                            > <UTILITY EXPENSES>--------
                            > some data...
                            >
                            > However, it was not able to find the FOOD EXPENSES. can someone tell me what is wrong with my code
                            >
                            >
                            >
                            >
                            >
                            > [Non-text portions of this message have been removed]
                            >





                            [Non-text portions of this message have been removed]
                          • Karl Kaufman
                            as a quick test, you might try loosening-up your regular expression, removing the end-of-record anchoring. (remove the $ ) ... I expect anchoring to the
                            Message 13 of 13 , Dec 23, 2010
                            • 0 Attachment
                              as a quick test, you might try loosening-up your regular expression,
                              removing the end-of-record anchoring. (remove the '$')

                              > if ($line =~ /^<(.*)>-+/) {

                              I expect anchoring to the beginning of the line and looking for the trailing
                              dashes should be sufficient to ident the header records, ya? (I'm wondering
                              if failing to "chop" the end-of-line whitespace causes differing behaviors
                              between Windows and Ubuntu10.)

                              Another test of the above would be to add a whitespace consideration to the
                              regular expression, allowing you to keep the end-of-record anchoring...

                              > if ($line =~ /^<(.*)>-+\s*$/) {




                              ----- Original Message -----
                              From: dhageuk
                              To: perl-beginner@yahoogroups.com
                              Sent: Wednesday, December 22, 2010 5:41 PM
                              Subject: Re: [PBML] please help



                              i forgot to tell that on windows it is working. but on ubuntu 10 it is not.
                              i tried debugging and was not able to find it.

                              --- In perl-beginner@yahoogroups.com, "Karl Kaufman" <krkweb@...> wrote:
                              >
                              > How do you know it wasn't able to find the 'FOOD EXPENSES' header without
                              > testing for it? (i.e. you're not doing anything in the script to verify
                              > whether the header was recognized) I added a print statement within the
                              > empty braces ({}) and it seemed to work fine.
                              >
                              >
                              > ----- Original Message -----
                              > From: dhageuk
                              > To: perl-beginner@yahoogroups.com
                              > Sent: Wednesday, December 22, 2010 4:13 AM
                              > Subject: [PBML] please help
                              >
                              >
                              >
                              > i have the following code:
                              >
                              > open filehandle, "$somefile";
                              > while (<filehandle>) {
                              > my $line = $_;
                              > if ($line =~ /^<(.*)>-+$/) {
                              > $cgroup = $1;
                              > next;
                              > }
                              > if ($cgroup eq 'FOOD EXPENSES') {}
                              >
                              > which attempts to open a file which contains:
                              >
                              > <FOOD EXPENSES>-----------
                              > some data...
                              > <UTILITY EXPENSES>--------
                              > some data...
                              >
                              > However, it was not able to find the FOOD EXPENSES. can someone tell me
                              > what is wrong with my code
                              >
                              >
                              >
                              >
                              >
                              > [Non-text portions of this message have been removed]
                              >
                            Your message has been successfully submitted and would be delivered to recipients shortly.