Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: hash problem

by licking9Volts (Pilgrim)
on May 21, 2002 at 15:57 UTC ( #168169=note: print w/ replies, xml ) Need Help??


in reply to uninitialized value on hash lookup (was: hash problem)

It looks like $Line isn't getting a value assigned to it. I think your split command should have parentheses around the regexp:

my ($Line, $Filed, $Dvalue) = split(/\t/);
If you're splitting a record on tabs, you might want to check if multiple tabs separate the fields. If so, you could use:
my ($Line, $Filed, $Dvalue) = split(/\t+/);
I'm a beginner PERL user but I hope that helps.

Update: Changed /\t*/ to /\t+/ to avoid unexpected results. Thanks esper!


Comment on Re: hash problem
Select or Download Code
Re: Re: hash problem
by dsheroh (Parson) on May 21, 2002 at 16:10 UTC
    Just one minor detail: You want to split on /\t+/ instead of /\t*/ since the * will also match 0 tabs and could split within a field (since there are 0 tabs between every pair of characters) instead of only between fields.
Re: Re: hash problem
by Anonymous Monk on May 21, 2002 at 17:09 UTC

    Thank you for your help!
    My first file is a table:
    Line Field Dvalue
    a123 A1 12.83
    a124 A1 9.68
    ...
    and second file is a table too:
    Name Data
    a123 acgt...(whole sequence)
    a124 catt...
    both table all use tab to separate each column. Please help!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-09-23 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (241 votes), past polls