in reply to Re: Defining hash structure
in thread Defining hash structure
I changed the content and inserted a ^ delimiter.
I have this but I don't know how to match the structure:
Really don't know much about hashes.use Path::Class; use Data::Dumper; my $dir = dir("C:\\temp\\"); my $file = $dir->file("hashinput.txt"); my $file_handle = $file->openr(); my %slotHash = (); while (my $line = $file_handle->getline()){ if (index($line, "Press", 0) == -1) { $delimiter = quotemeta("^"); my @values = split(/$delimiter/, $line); %slothash = (slot => @values[0] => [type => @values[1]]); } } print Dumper(%slothash);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Defining hash structure
by pme (Monsignor) on Aug 25, 2014 at 09:55 UTC | |
by mtx (Initiate) on Aug 25, 2014 at 11:03 UTC | |
|
Re^3: Defining hash structure
by Anonymous Monk on Aug 25, 2014 at 09:30 UTC |