in reply to How can one initialize the scalar $reg_no in hash element?
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.while (<Rdata.txt>) { my ($name, $age, $reg_no )=split":"; $studentsDB {$reg_no}={Name => $name, # Line 52: uninitialized reg_ +no Age => $age,};}
Tips from the Basic debugging checklist:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How can one initialize the scalar $reg_no in hash element?
by supriyoch_2008 (Monk) on Apr 03, 2013 at 01:57 UTC |
In Section
Seekers of Perl Wisdom