Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O

by schwern (Scribe)
on Jul 16, 2005 at 00:14 UTC ( #475391=note: print w/ replies, xml ) Need Help??


in reply to Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O

Use the error message. Use of uninitialized value in concatenation (.) or string at C:\Perl\Orange\pop_db.pl line 18, <FILE> line 46062.

The key is "line 46062". Perl is telling you that the uninit value is encountered when executing line 18 of your program AND that the last line read from the last opened filehandle (FILE) was 46062. This information would provide useful except that you slurped in the entire file before processing it. Not only wasteful of memory but since everything in the loop happens after you read the whole file they *all* appear to happen at line 46062.

If you modify your code to process the file a line at a time the warning will identify for you exactly what line in the data is corrupt.

open (FILE, "$ARGV[0]") || die "\n$!\n"; print "\n\nPlease wait......Populating Database\n"; while(my $entry = <FILE>) { chomp $entry; ...process $entry as normal... } close FILE;


Comment on Re: Most Annoying Error : Use of uninitialized value in concatenation (.) or string at C:\Perl\O
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://475391]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-09-30 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (370 votes), past polls