in reply to Perl list emulation in Java...

Interestingly, this is not terribly uncommon. While living in Amsterdam and being forced to endure the hell that is VBScript, I wrote many of the same routines for that language. Like you, though, I failed to emulate them properly. For example, push actually returns the number of elements added to the array:

public int push( PerlList list ) { Enumeration elems = list.elements(); while( elems.hasMoreElements() ) addElement( elems.nextElement() ); return list.size(); }

Of course, I can't help but wonder if that's a waste of time. I don't recall ever seeing any code that actually checks that return value, but then, if you're going to emulate... :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.