in reply to How it works?
This
sub rand_elt { $_[rand @_] }
is a terse version of that:
sub rand_elt { my @keys = @_; my $num_keys = scalar @keys; my $random_index = int( rand($num_keys) ); return $keys[$random_index]; }
In my experience, writing a nifty condensed sub like the one below "This" will gain you the questionable reputation of writing "write-only code" at your company or elsewhere, among those which aren't familiar neither with the concepts of perl nor with the language in general. Best is to endure such as camels do - with some sort of सच्चिदानन्द at the beast level for starters, or higher.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How it works?
by Your Mother (Archbishop) on Jan 21, 2016 at 00:34 UTC | |
by shmem (Chancellor) on Jan 21, 2016 at 07:11 UTC |