--- David Blevins wrote:
Truly astounding. lol....
From: Paul
well!
Truly astounding. lol....
From: Paul
--- David Blevins wrote:
Tries to lookup the line in the hash of lines we've already seen.
$seen{$_}++
This is a complete guess, I can't seem to find anything like this
in the 'Programming Perl' book.It's just a postfix increment on the value in %seen as looked up
using $_ as the key. You've got the idea.
So the command not only weeds out the duplicate lines, it counts asperl -nle 'print if !$seen{$_}++'
$seen{$_}Tries to lookup the line in the hash of lines we've already seen.
$seen{$_}++
This is a complete guess, I can't seem to find anything like this
in the 'Programming Perl' book.
using $_ as the key. You've got the idea.
well!
The boolean NOT ( the ! ) always returns 1 if the $seen{$_} is false,
or '' if it's true -- and any value other than 0,'', or undef is true.
That's great! I hate to even think of how many lines in java it
would take to do the same thing. It takes on line just to create
the hash.
lol -- true. But remember one thing for which Perl is famous: the wordwould take to do the same thing. It takes on line just to create
the hash.
is "cryptocontext". Expressions do/return different things in different
contexts. Important to understand, and handy to use. Java expressions
don't change behavior or value if you change their context. Perl has
tools many other languages don't have, but they can bite you. =o)
I love Perl. =o)
Of course, writing readable code is always a good idea, but
explaining *tight* code is a great learning experience! lol!
I am a very accomplished java programmer and many aspects ofOf course, writing readable code is always a good idea, but
explaining *tight* code is a great learning experience! lol!
programming are just old news. I really have zero need to learn
another language in my professional career.
available. =o)
But since I've ran across Perl, I've found so many new
ways to do things that were just old hat -- I just have to learn it.
Perl takes something I've been doing for years and makes it new
again.ways to do things that were just old hat -- I just have to learn it.
Perl takes something I've been doing for years and makes it new
Yeah. >;O}
Gearhead Heaven! lol!
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/