Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 ( [id://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;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-28 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found