Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Uninitialized value in substr command

by Anonymous Monk
on Aug 20, 2014 at 23:04 UTC ( [id://1098174]=note: print w/replies, xml ) Need Help??


in reply to Uninitialized value in substr command

"Use of uninitialized value in substr at line 19." But I can't figure out what value it's talking about.

Try adding use diagnostics; at the top of your program, you'll get a slightly longer explanation of errors and warnings. In this case the "uninitialized" warning means that one of the variables used had a value of undef, which happens e.g. when the variable has never been assigned anything, when you try to access array elements that you don't exist, or when the variable has been explicitly assigned undef at some point (see Declarations and undef). Also, another tool from the Basic debugging checklist is Data::Dumper, which makes it much easier to see your data structures (including undef). In this case you could have written print Dumper(\@contigfile,$element1,$element2); to see the current values of those variables.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found