On Tue, Feb 19, 2002 at 06:47:14PM +0000, John P. Looney wrote:
> On Tue, Feb 19, 2002 at 06:44:16PM +0000, kevin lyda mentioned:
> > next thing you'll say multi-level map's in perl (each with large anonymous
> > functions) are bad. it's just the way i think damnit!
> > kevin, who makes a point of using the ternary operator wherever possible...
> What's that ? I assume its some sort of twisted mutation of C's binary
> "?" operator, yeah ?
oh no, it's much better. it runs the code block it's given on each
element of the array it's passed and returns the resulting array.
so this:
@x=(1, 2, 3);
print(map { $_++ } (@x), "\n");
print(@x, "\n");
will print:
234
123
of course the amazing algorithms you can build with that when you add
in hashes and such are just joyous...
kevin
--
kevin at suberic.net buffy: come on, can't you put your foot down?!
fork()'ed on 37058400 giles: it *is* down.
meatspace place: orbit buffy: one of these days you're going to have to
http://suberic.net/~kevin get a grown up car. --inca mummy girl
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!