On Tuesday, April 16, 2002, at 04:15 , David Gray wrote:
Another INSANE, but actually useful, illustration from Jenda: { how does he pop them out? } >> Example: >> >> sub foo { (0,1,2,3,4,5,6,6,8,9) }; >> >> (undef,undef,undef,undef,@a1) = foo(); >> @a2 = (foo())[4]; >> >> print join(", ", @a1),"\n"; >> print join(", ", @a2),"\n"; > > Oh, hehe, right... Silly me! > > -dave p0: given that few hosts are 'double/multi homed' such that they will actually return multiple IP_ADDR - the cheat is not a bad idea. # As long as you comment it that way. p1: hence it follows that picking out a given scalar from a return in the form my $one_answer = (funkCall(@argList))[$thatArg] ; is actually a COOL idea for all of those my ($var1, $var2, $j, $k, .... ) = funk_with_large_list_return(@argList) ; where you only wanted the one element... # as long as appropriately commented p2: So I thought I would posit the following: #!/usr/bin/perl -w use strict; sub foo { my @list = (0,1,2,3,4,5,6,6,8,9) ; my @front = qw/bob fred alice 2/; return( @front, \@list ); } my (undef,undef,undef,undef,@a1) = foo(); my @a2 = (foo())[4]; print join(", ", @a1),"\n"; print "@a2 \n"; which I thought would pass the @list though and mostly gets me there but: vladimir: 73:] ./jenda.pl ARRAY(0x1273c4) ARRAY(0x135534) vladimir: 74:] so I know it's an ARRAY - how do I get into it? ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]