Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: Parse a file into a hash

by mendeepak (Scribe)
on Apr 07, 2012 at 05:55 UTC ( #963887=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Parse a file into a hash
in thread [Resolved] Parse a file into a hash

hi check if this code works or not its not tested.

my ($key,$val,$keyprev); open(fh,'< file.txt'); while (<fh>){ $keyprev=$key; ($key,$val)=split /\;/, $_; $key=$keyprev if($key eq""); print "$key :: $val\n"; } close fh;


Comment on Re^5: Parse a file into a hash
Download Code
Re^6: Parse a file into a hash
by kazak (Beadle) on Apr 09, 2012 at 14:43 UTC
    Yes it helped. Thanks to everyone.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-07-04 08:45 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 (58 votes), past polls