| |
| |
| |
|
Comments:
<0> anyone know of a module, maybe perl socket. That will allow me to play with sending fragmented packets? <1> Hi, all. <1> My question is to do with Multidimensional hashes. <1> I seem to be overwriting a (supposedly) hash inside a hash as if it were a variable. <1> These are the 4 lines that are meant to add the data. <1> fileData => <1> { <1> $objName => $fileSize <1> }
<1> (apologies for the mini-flood) <1> $objName takes in a filename as the key <1> It's within a File::Find subroutine <1> I've tried using $fileData, although this throws an explicit package name error <1> How do I get every new $objName to be stored in fileData, not just the most recent 'overwritten'? <1> (Sorry about being so vague. I can go into further detail if required.) <2> $objName should be a unique key. <1> it is <2> It appears to always have the same value. <2> Else it shouldn't be overiting the has key-value pair. <1> $_ p***es the filename that File::Find comes up with as a key <1> I could have used just $_ as the key <1> I'll try that <1> nah..same thing <1> so if I have: $objName = $_; <1> can't I then use $objName as the key? <2> does keys({%fileData}) return only one element? <1> (I want to then sort the $objNames later so that's why I'm being a bit nark-y) <1> It's meant to return as many elements as are in a directory <1> as it goes through, I'm trying to populate %fileData with each: file => filesize pair <1> I should really rename $objName <1> mybad <1> elsewhere I have this: <1> $dirList{$dirName} = <1> { <1> fileData => $dirList{$dirName}{fileData}, <1> }; <1> would you like me to post it on a nopaste? <1> the entire code? <1> It's under 175 lines <1> well, the actual section with which I'm having trouble is just over 100 <1> Whoops. The answer to your question before was yes. It only returns one element. <1> Although I've run a Dumper after every call through the File::Find routine and it shows that the element gets overwritten.
<2> $objName has the same value in every loop, then. <1> How? It gets ***igned to a different filename each time. And there can't be 2 files of the same name in the same directory. <2> $objName->{$FileName} type thing perhaps? <1> I don't follow. <1> So I can't use $objName as a key if it's unique? <1> if I do $objName -> {$__} that gives me the hex number in memory <1> I've defined $objName = $_; <1> I don't think it's the uniqueness of $objName <1> I think it lies with fileData not being recognised as a hash <1> actually..no...that's not right <1> because it prints the key => value pair in Dumper <1> but only the last one <1> I get: <1> $VAR7 = 'FLU'; <1> $VAR8 = { <1> 'fileData' => { <1> 'crab.ly' => 154 <1> }, <1> }; <1> $VAR7 = 'FLU'; <1> $VAR8 = { <1> 'fileData' => { <1> 'TROjAN.mix' => 52 <1> }, <1> }; <1> instead of <1> $VAR7 = 'FLU'; <1> $VAR8 = { <1> 'fileData' => { <1> 'crab.ly' => 154 <1> 'TROjAN.mix' => 52 <1> }, <1> }; <1> Hi cynII. I've got a problem with multi-dimensional hashes where instead of a nested hash expanding, a key => value pair is constantly overwritten. <1> Care to help? <1> Darkchanter has given some helpful input, but I still can't gauge as to what the problem is. <1> ...and I guess he's gone to drink on it. <1> :d
Return to
#perl or Go to some related
logs:
faiya chat #chat-world #chat-world #kl #allnitecafe #kl chate world
akhiyan tu
#allnitecafe #php
|
|