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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. RBergin

    IF Statement Syntax Error

    if ($overrelatefil{tin} ne "|||") { print OVERRELATEFI "\n" }
  2. RBergin

    Perl script - remove duplicates from text file.

    Or, for a more robust approach, you could use one of the getopt modules to use command line switches and execute your script like this: myscript.pl -i <input filename> -o <output filename>
  3. RBergin

    IF Statement Syntax Error

    There are a number of improvements that could and should be made, but first lets track down the syntax error. I don't receive a syntax error with the change I suggested. C:\test>perl -c mark1110.pl mark1110.pl syntax OK C:\test>type mark1110.pl # # nbr_FormatRelateRecord.pl # #...
  4. RBergin

    Perl script - remove duplicates from text file.

    You need to remove the line terminator from the input from the user. change: $file = <STDIN>; to: chomp($file = <STDIN>);
  5. RBergin

    IF Statement Syntax Error

    I'd need to see a sample of the input data and a better explanation of your goal. But see if this change gives you what you want. print OVERRELATEFIL ( trim($overrelatefil{tin}), trim($overrelatefil{parent_tin}), trim($overrelatefil{paid_tin})...
  6. RBergin

    IF Statement Syntax Error

    Why are you putting that print statement in an unless block? OVERRELATEFIL is a filehandle and can't be used like that in an if statement. Change it to: if ( $overrelatefil{tin} eq "|||" ) { Your trim sub is unnecessary and makes the script a little less efficient. It would be better to...
  7. RBergin

    Syntax Error

    The script you posted was incomplete, so which line in that code is the line 49 that the warning is referring to?
  8. RBergin

    Syntax Error

    Mark, There's no syntax error in that code UNLESS you're running under strictures, which it's obvious that you're not using the strict pragma. EVERY Perl script you write should include the strict and warnings pragmas i.e., use strict; use warnings; All non global vars that are declared with...
  9. RBergin

    error managment

    See if any of these modules do what you want. http://search.cpan.org/search?query=trycatch&mode=all You can also take a look at the eval function. http://perldoc.perl.org/functions/eval.html
  10. RBergin

    mysql prepare won't work outside of my loop

    If you still receive the same error, you should add a print statement above the execute statement that outputs the data to be inserted, namely $uwind[$i]. Since the error states that the data was truncated, it would appear that it's attempting to insert more data in that field than what the db...
  11. RBergin

    mysql prepare won't work outside of my loop

    <FILE> line 193348 That part of the error message seems odd since <FILE> was slurped into an array and at this point <FILE> has nothing to do with the sql statement. Try changing it to this: open(my $FILE1, '<', $filename) or die $!; my @uwind = <$FILE1>...
  12. RBergin

    mysql prepare won't work outside of my loop

    Please show the updated code after moving the prepare statement and post the complete error message. It would also be helpful for you to fix your indentation and declare the vars in the smallest scope they require.
  13. RBergin

    mysql prepare won't work outside of my loop

    Try passing all of the values in the execute statement. In your other post "String variable won't work outside of loop" the error message you posted mentioned "Data truncated for column 'U' at row 1 at line 93, <FILE>". What does line 93 of your data file look like?
  14. RBergin

    how can i change into switch statement

    s/boss/teacher/
  15. RBergin

    How to stop Perl from removing table formatting from mysql command?

    You need both. DBI - Database independent interface for Perl DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI)
  16. RBergin

    Perl displaying problems

    Hi Kevin, If you think those prices are high, you should take a 5hr drive up the coast and see what we have up here. Prices around here are at least double.
  17. RBergin

    Make all variables &quot;local&quot;

    Perl is not DCL so IMO there's no valid reason to want them to act the same. Do you feel the same way with bash scripts? Declaring all of your vars with local means that you're not running under strictures, which is bad, and you may not even have warnings enabled. The combination of the...

Part and Inventory Search

Back
Top