Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by FeiLung

  1. FeiLung

    Grouping and Page Breaking

    Basic report generating question. I have a dataset that I would like to sort, group, and print all fancy like. The kind of basic report one could generate with MS Access. Field names are: Name - Name of person who owns record Sname - First Last Name Address - 1313 Mocking Bird Lane City -...
  2. FeiLung

    DBI Number of Rows Changed

    No it does not execute the die command. It simply returns a 1, but does not update the table. So that being said, If I do the following: select count(*), filler1 from table where filler1="" group by filler1 How would I go about testing the results? If the resulting count is 0, then I can...
  3. FeiLung

    Complex Sort

    It is important to evenly distribute the recors. I would love to have the ability to stack the rows specifically by zip code. Plus its a very interesting problem that I would love to work out in Perl. - FL
  4. FeiLung

    Complex Sort

    What I would like to do is iterate through the file sorting on the ZIP field, evenly distributing the records through out the file. Example if my file contains the following quantities of zip codes. QTY ZIP 3 98765 2 12345 2 78934 Then my file would be sorted somewhat...
  5. FeiLung

    DBI Number of Rows Changed

    My sanity has been checked. :) Running the SQL by hand produces the results I am looking for. I have a table with 10 records. When run by hand the records are updated. I am aware of the reserved word conflict. This is just an example swapping out the table and field names. One thing I did...
  6. FeiLung

    DBI Number of Rows Changed

    I pulled the same info from the CPAN docs. I thought I might have done something wrong since the only output I get is a 1. When I do print "$rows_affected\n"; I get a 1 FL
  7. FeiLung

    DBI Number of Rows Changed

    Quick question on DBI. Using the following example code. my $sql = qq{ UPDATE table set field1 = "A" WHERE field2 = "" }; $dbh->do( $sql ); What would I need to do to return the total number of records that were changed? Thank you. FL
  8. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    This is what I ended up with. It works like a champ. my $total; for my $key (keys %info) { if (($info{$key}{I}) && ($info{$key}{O})) { $total = $info{$key}{I} + $info{$key}{O}; } elsif ((!$info{$key}{I}) and ($info{$key}{O})) { $total = $info{$key}{O}; } elsif...
  9. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    I was looking for a solution to this error at run time: Use of uninitialized value in addition (+) at ./sql.pl line 111. Line 111 is: my $total = $info{$key}{I} + $info{$key}{O}; My thinking was since there are records where there is no data for example $info{$key}{I} then the string was...
  10. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    It appears that comparing them assignments to 0 does not work. I beleive perl is having a problem with it because if there is no data for $info{$key}{I} or $info{$key}{O} then the strings are never created. So we are trying to evaluate a string that does not exist. if (($info{$key}{I}) &&...
  11. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    I was able to use the following to make sure that the hash contains the correct information: for my $keys ( keys %info ) { print "$keys: "; for my $value ( keys %{ $info{$keys} } ) { print "$value=$info{$keys}{$value} "; } print "\n"; } But one problem became...
  12. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    Just re-reading your post you also mentioned a hash of hashes. I have done a little reading with the help of google and I have to say I am completely confused now. I understand the concept but can't seem to find any examples that actually explain what is happening. Just code snippets.
  13. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    travs69, Would you be so kind as to explain your code a little. Hashes are very new to me and I am a little confused by your example.
  14. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    That is exactly it KevinADC. I am at a complete loss as to how to proceed once I have the data all in one place. If you can help direct me on how to read the data from the database so that I can produce the numbers I need that will be fantastic. FL
  15. FeiLung

    Using Perl to Crunch Numbers in a SQL Table

    Here is what I have. #!/usr/bin/perl -w use strict; use Date::Calc qw(Days_in_Month System_Clock Add_Delta_YM); my ($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) = System_Clock(); my ($ReportYear,$ReportMonth,$ReportDay) = Add_Delta_YM($year,$month,$day, 0, -1); my $ReportY2D = substr...

Part and Inventory Search

Back
Top