in reply to (OT) Interview questions -- your response?
my @c = do { my %tmp = map { $_ => 1 } @a; grep {$tmp{$_}} @b };Here's my take on Q2 which ended up the same as others:
for (1..@foo/2) { @foo[$_-1,-$_] = @foo[-$_,$_-1]; }The first thing that came to mind was:
@foo = map { pop(@foo) } 1..@foo;But that's not precisely an in-place version, even though you could argue that the temporary "array" only holds things that have been removed from @foo.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (OT) Interview questions -- your response?
by demerphq (Chancellor) on Sep 04, 2002 at 19:01 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. | |
A reply falls below the community's threshold of quality. You may see it by logging in. |