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

Re: [PBML] Perl script to read

Expand Messages
  • Shlomi Fish
    ... Hi Gopi! 1. Please read: http://perl-begin.org/topics/cpan/ and be enlightened. 2. perl-5.8.5 is really old, you really should upgrade to perl-5.8.9 or
    Message 1 of 15 , Jan 26, 2010
    • 0 Attachment
      On Tuesday 26 Jan 2010 04:19:56 gopi chand wrote:
      > Hi Merlyn ,
      >
      > Thanks for the reply.I havent' read that documentation but I started of
      > with a sample pl script I got over the internet but I am getting the
      > following message while running the script What am I missing?
      >
      > Can't locate Spreadsheet/Read.pm in @INC (@INC contains: C \Program
      > Files\ActiveState Perl Dev Kit 6.0\lib\
      > /usr/lib/perl5/5.8.5/cygwin-thread-multi-64int /usr/lib/perl5/5.8.5
      > /usr/lib/perl5/site_perl/5.8.5/cygwin-thread-multi-64int
      > /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl
      > /usr/lib/perl5/vendor_perl/5.8.5/cygwin-thread-multi-64int
      > /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl .) at
      > sample.pl line 4.

      Hi Gopi!

      1. Please read: http://perl-begin.org/topics/cpan/ and be enlightened.

      2. perl-5.8.5 is really old, you really should upgrade to perl-5.8.9 or
      perl-5.10.1.

      Regards,

      Shlomi Fish

      >
      >
      > --- On Mon, 1/25/10, merlyn@... <merlyn@...> wrote:
      >
      > From: merlyn@... <merlyn@...>
      > Subject: Re: [PBML] Perl script to read
      > To: "GoPi" <gopichand84@...>
      > Cc: perl-beginner@yahoogroups.com
      > Date: Monday, January 25, 2010, 5:56 PM
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > >>>>> "GoPi" == GoPi <gopichand84@ yahoo.com> writes:
      > GoPi> 1.I have an excel sheet in 2003 with columns like below
      >
      >
      >
      > GoPi> A Yes
      >
      > GoPi> B No
      >
      > GoPi> C Yes
      >
      > GoPi> D Yes
      >
      >
      >
      > GoPi> 2.I have a file "sample.txt" which contains all the leters like below
      >
      >
      >
      > GoPi> A
      >
      > GoPi> B
      >
      > GoPi> C
      >
      > GoPi> D
      >
      >
      >
      > GoPi> Now,I my objective is to write a perl script to output only the
      > letters
      >
      > GoPi> that are listed as "Yes" in my excel sheet.Can some pls help to give
      > me
      >
      > GoPi> a starting point?
      >
      >
      >
      > How much of the documentation for Spreadsheet: :ParseExcel have you read
      > and
      >
      > understood? Do you have specific questions about that module?

      --
      -----------------------------------------------------------------
      Shlomi Fish http://www.shlomifish.org/
      Freecell Solver - http://fc-solve.berlios.de/

      Deletionists delete Wikipedia articles that they consider lame.
      Chuck Norris deletes deletionists whom he considers lame.

      Please reply to list if it's a mailing list post - http://shlom.in/reply .
    • gopi chand
      Do the order of the letters in the second file matter? ... if the letter is next to yes in your excel file AND the letter appears somewhere in the second
      Message 2 of 15 , Jan 26, 2010
      • 0 Attachment
        Do the order of the letters in the second file matter?
        >>  Yes it matters

        if the letter is next to "yes" in your excel file AND

        the letter appears somewhere in the second file, THEN

        output the letter?
        >>>> Can you pls tell me how do I do that?


        --- On Mon, 1/25/10, Jeff Soules <soules@...> wrote:

        From: Jeff Soules <soules@...>
        Subject: Re: [PBML] Perl script to read
        To: "gopi chand" <gopichand84@...>
        Cc: perl-beginner@yahoogroups.com
        Date: Monday, January 25, 2010, 8:36 PM







         









        > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?



        Ahh. I was wondering how the second file figured in this whole business.

        Do the order of the letters in the second file matter? i.e. is your goal:



        if the letter is next to "yes" in your excel file AND

        the letter appears somewhere in the second file, THEN

        output the letter?



        If so, I would read the letters in the second file and load them into

        a hash (%lettersHash, perhaps.)

        Then go back and read the excel file through one of the methods

        discussed previously (the method you choose shouldn't affect your

        results for the problem as you've described it, There's More Than One

        Way To Do It, etc).

        For each row/record of the excel file, if the value of the second

        column is "yes," check if the value in the first column is in

        %lettersHash. If it is, output the letter. If not, read the next

        record.



        On the other hand, if you want to do something more complicated (like

        if the order of the second file matters -- say you only output the

        letter if row N of the excel file says "A Yes" and row N of the second

        file says "A"), then please describe your problem in more detail.



        good luck,

        jeff



        On Mon, Jan 25, 2010 at 9:22 PM, gopi chand <gopichand84@ yahoo.com> wrote:

        >

        >

        > Thanks for the reply Jeff.

        >

        > I don't want to print all the letters in the first column which have an "yes" in second column,I only want to print the ones in sample.txt file,how are we taking care of this condition?

        >

        >

        > --- On Mon, 1/25/10, Jeff Soules <soules@gmail. com> wrote:

        >

        > From: Jeff Soules <soules@gmail. com>

        > Subject: Re: [PBML] Perl script to read

        > To: "perl-beginner@ yahoogroups. com" <perl-beginner@ yahoogroups. com>

        > Date: Monday, January 25, 2010, 6:01 PM

        >

        >

        >

        > I would begin by saving the excel file in a plain text format. Tab-

        > delimited would likely work well, if this is a complete description of

        > the doc (if there aren't any tabs or anything).

        >

        > Then I would read the file in line by line and use split to get the

        > two columns (these are 2 columns right?) into separate fields. Use

        > regex or string comparison (eq) to see if the second field is yes, and

        > if it is, print the first field.

        >

        > There are no doubt more robust solutions, but something along these

        > lines ought to get you started if it's just a quickie.

        >

        > Good luck.

        >

        > On Jan 25, 2010, at 8:39 PM, "GoPi" <gopichand84@ yahoo.com> wrote:

        >

        > > Hi friends,

        > >

        > > Hopeeveryone is doing good.

        > >

        > > 1.I have an excel sheet in 2003 with columns like below

        > >

        > > A Yes

        > > B No

        > > C Yes

        > > D Yes

        > >

        > > 2.I have a file "sample.txt" which contains all the leters like below

        > >

        > > A

        > > B

        > > C

        > > D

        > >

        > > Now,I my objective is to write a perl script to output only the

        > > letters that are listed as "Yes" in my excel sheet.Can some pls help

        > > to give me a starting point?

        > >

        > > Thanks























        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.