eggzeck's Journal
http://use.perl.org/~eggzeck/journal/
eggzeck's use Perl Journalen-ususe Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners.2012-02-08T23:02:28+00:00pudgepudge@perl.orgTechnologyhourly11970-01-01T00:00+00:00eggzeck's Journalhttp://use.perl.org/images/topics/useperl.gif
http://use.perl.org/~eggzeck/journal/
The auto-increment operator
http://use.perl.org/~eggzeck/journal/31455?from=rss
As I read the perlop manpage (a while back, as everyone should), I find that the auto-increment operator "++" has a bit of built-in magic. Basically: If you use a variable in string context since it was set (other rules apply, read the perlop manpage for more information), the increment is done as a string.
<br> <br>
Following these rules, and of course with some creativity, I came up with a way to print my nick "eggzeck"; of course this is for fun, and I'm sharing it for fun/educational purposes. Well, I don't know how much you'll actually learn from this, so it's mostly for fun.
<br> <br>
Here's what I came up with:
<br> <br>
<code> <small>$nick = join("", map(++($holder = $_), qw(d f f y d b j)));</small> </code>
<br> <br>
Pretty cool? The $nick variable will now contain the string "eggzeck".<nobr> <wbr></nobr>:-)eggzeck2006-10-31T09:29:58+00:00journal