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

Help!!!!

Expand Messages
  • folkartkits
    Hi everyone, I am very new at all this but I need help. This is my problem: Here is the code: open(PRDLOG,$sc_prd_log_path)||die cant open $sc_prd_log_path ;
    Message 1 of 1 , Aug 5, 2002
    • 0 Attachment
      Hi everyone,
      I am very new at all this but I need help. This is my problem:
      Here is the code:

      open(PRDLOG,$sc_prd_log_path)||die "cant open $sc_prd_log_path";

      @lines=<PRDLOG>;
      close(PRDLOG);


      foreach $prd(@lines)
      {
      chomp($prd);
      ($phrase,$number)=split(/\|/,$prd);

      $phrase_array{$phrase}=$number;
      }

      $phrase_array{$product} += $quantity;
      {@keys=sort {$phrase_array{$a} <=> $phrase_array{$b}} keys(%
      phrase_array)}

      open(PRDLOG,">$sc_prd_log_path");

      foreach $key(@keys)
      {

      print PRDLOG qq~$key|$phrase_array{$key}\n~;
      }
      close(PRDLOG);
      --------------------------------------------------------------------
      SAMPLE PRDLOG

      945|Delta Ceramcoat 2oz Toffee Brown D2086|1
      946|Winter Garden Letter Box PPDA-WGLB|2
      --------------------------------------------------------------------
      The current code works to write $phrase,$number to the log , but
      misses the beginning number field. What needs to be added or changed
      to allow this to happen??? Note numbered field will stay the same

      Thanks

      ps $product and $quantity are from other parts of the script.
    Your message has been successfully submitted and would be delivered to recipients shortly.