only 10 lines at a time

Discussion in 'Perl' started by Todd Anderson, Jan 20, 2004.

  1. Hello,
    I have a script that needs to open a fat file > determine which lines
    represent lines say 251-260 (@billingnumber) and ($yes_row)> and which
    lines represent the ignored lines ($hold_row) > then do a bunch of stuff
    to the lines i want ($yes_row).
    The code below isn't finding the yes_lines. (probably if($billingnumber
    ne "$e_number"){ is wrong.)
    Any help is appreciated.
    Thanks in advance for your help.

    open (USERS, "$file") || &billerror
    ("$file Billing Notice" );
    flock(USERS, 2);
    while (<USERS>)
    {
    $line = $_;
    chomp $line;
    @line = $line;
    @fields = split (/\|/, $line);
    $billingnumber = @billingnumber;
    foreach $line (@line){
    $e_number++;
    if($billingnumber ne "$e_number"){ # Save all the ignored lines
    $hold_row .="$line\n"; }
    else{ $yes_row .="$line\n"; #find the lines i want
    @yes_row = $yes_row;
    }#else
    }#e_number

    foreach $line2 (@yes_row){
    chomp $line2;
    @fields = split (/\|/, $line2);
    #do a bunch of stuff to yes lines
    }# foreach line2
    }#while
    flock(USERS, 8);
    close (USERS);
     
    Todd Anderson, Jan 20, 2004
    #1
    1. Advertising

  2. Todd Anderson wrote:
    > I have a script that needs to open a fat file > determine which
    > lines represent lines say 251-260 (@billingnumber) and ($yes_row)>
    > and which lines represent the ignored lines ($hold_row) > then do a
    > bunch of stuff to the lines i want ($yes_row).
    > The code below isn't finding the yes_lines. (probably
    > if($billingnumber ne "$e_number"){ is wrong.)


    That code makes no sense to me. It's badly written, and accordingly
    difficult to debug. Ask the author for help.

    Also, please note that this group is defunct, and replaced several
    years ago with comp.lang.perl.misc. You'd better not ask questions here.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Jan 20, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack
    Replies:
    9
    Views:
    2,677
  2. Joe Wright
    Replies:
    0
    Views:
    524
    Joe Wright
    Jul 27, 2003
  3. flamesrock
    Replies:
    8
    Views:
    469
    Hendrik van Rooyen
    Nov 24, 2006
  4. lovecreatesbeauty

    How to know two lines are a pare parallel lines

    lovecreatesbeauty, Apr 27, 2006, in forum: C Programming
    Replies:
    11
    Views:
    668
    Old Wolf
    Apr 28, 2006
  5. Replies:
    1
    Views:
    456
    Jonathan Mcdougall
    Dec 6, 2005
Loading...

Share This Page