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.
In reply to Re: (OT) Interview questions -- your response?
by tadman
in thread (OT) Interview questions -- your response?
by Ovid
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |