|Problems? Is your data what you think it is?|
Re: Re: Z80 Assembler -> Hex Opcodeby Elgon (Curate)
|on Feb 09, 2003 at 12:52 UTC||Need Help??|
I did indeed realise this, however in the code as you have written it the declaration of %opcodes is in a different scope to that of the subroutine and hence, all you get returned is an error. I am not sure exactly how to access the hash from the subroutine's scope - %main::opcodes ???
I did also originally run the program without the encode routines as a separate sub and it didn't appear to run any faster.
Update: I tried running the program as a simple loop, without the sub as before, and it took about 1 second instead of 36 or so to run. Must have declared the hash inside the loop the first time. Oops. Time to go back to the Blue Camel and re-read the sections on scoping and packages :-)
Update^2: I've been trying to do what you suggest by passing a reference to %opcodes to the subroutine along with the line and then saying local *hash = shift; a la blue camel page 294 but this isn't liked either. FYI I'm using Perl 5.005 so use of our is right out.
Update^3: See root node.
"What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."