Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How can one initialize the scalar $reg_no in hash element?

by toolic (Bishop)
on Apr 02, 2013 at 16:44 UTC ( #1026737=note: print w/ replies, xml ) Need Help??


in reply to How can one initialize the scalar $reg_no in hash element?

while (<Rdata.txt>) { my ($name, $age, $reg_no )=split":"; $studentsDB {$reg_no}={Name => $name, # Line 52: uninitialized reg_ +no Age => $age,};}
Are you trying to read lines from the file named Rdata.txt? If so, that won't do it. You probably want to open that file first. I think your warning message occurs because split operates on $_ in your code, and $_ is probably undefined (or at least does not have 3 ":"'s in it.

Tips from the Basic debugging checklist:


Comment on Re: How can one initialize the scalar $reg_no in hash element?
Download Code
Replies are listed 'Best First'.
Re^2: How can one initialize the scalar $reg_no in hash element?
by supriyoch_2008 (Scribe) on Apr 03, 2013 at 01:57 UTC

    Hi toolic,

    Thanks for the suggestions and for providing the links to Basic degugging checklist.

    With kind regards

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2015-07-29 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls