Prabhu Gurumurthy wrote: > > Hi All, > > I have a C program which i want to convert it into perl > In the C program it is given like this > > typedef unsigned short u_int16; > #define dataLen 4 > #define keyLen 52 > #define userkeyLen 8 > #define DataT(v) u_int16 v [dataLen] > #define keyT(v) u_int16 v [keyLen] > #define UserKeyT(v) u_int16 v [userKeyLen] > > void function(DataT(dataIn), DataT(dataOut), keyT(key)); > > how can i convert the above lines into perl scripts, i thought that getting > the datalen from the input would solve the problem but how to get the > datalen of that variable in PERL? > As Curtis Poe already said, it's hard to say how to translate the above code to Perl.
I hope, nobody will take too serious, what I'll say in the next lines :-) What do the C lines above? The define some data structure. Perl is in the most cases so modern, that it can detect the data structure for its own. Especially it's not necessary to define the length of an array, to say the number variable is short or integer or a float. Perl will find it out for itself. So without any more knowledge of the problem, I'd suggest to take an empty file. And wew, the empty file is the translation of this C code :D Cheers, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]