Re: fun with hashes!

2007-11-23 Thread Scott Wiersdorf
runs *way* faster than the $_ aliasing does in the map (at least by my benches). I thought that was fun when I saw it. Scott -- Scott Wiersdorf [EMAIL PROTECTED]

Re: grep substitute

2002-12-13 Thread Scott Wiersdorf
On Fri, Dec 13, 2002 at 05:31:35PM -0700, Scott Wiersdorf wrote: > FWPers, > > Pretending your machine did not have e?grep, how concisely could you > duplicate the GNUish "-q" (silent) functionality: stop scanning on > first match and exit(0). If no match, exit(1). >

grep substitute

2002-12-13 Thread Scott Wiersdorf
t slurping the whole file? Any takers? Scott -- Scott Wiersdorf [EMAIL PROTECTED]

Re: shortest test for truth & false assignment

2002-05-22 Thread Scott Wiersdorf
ted) is: $a && $a-- && do { do_something(); ... } Two questions: a) can it be shortened to fewer characters? and b) is there another way to do it better in general? This has been a fun thread, btw (for me, anyway). Thanks. Scott -- Scott Wiersdorf [EMAIL PROTECTED]

Re: shortest test for truth & false assignment

2002-05-22 Thread Scott Wiersdorf
oned it, unless I'm missing something... These statements unconditionally alter $a (unless _I'm_ missing something). $a should only be set to 0/false iff $a is 1/true. Scott -- Scott Wiersdorf [EMAIL PROTECTED]

Re: shortest test for truth & false assignment

2002-05-22 Thread Scott Wiersdorf
On Wed, May 22, 2002 at 01:04:53PM -0600, Scott Wiersdorf wrote: > My shortest try is this (10 characters w/o whitespace): > > if( $a%2 .. $a-- ) { > do_something(); > ... > } Ok, this is also 10 characters: if( $a=~s/.+// ) { ... } and has the (s

Re: shortest test for truth & false assignment

2002-05-22 Thread Scott Wiersdorf
On Wed, May 22, 2002 at 01:04:53PM -0600, Scott Wiersdorf wrote: > My shortest try is this (10 characters w/o whitespace): > > if( $a%2 .. $a-- ) { > do_something(); > ... > } I put the ellipses in there after the do_something() because there'

shortest test for truth & false assignment

2002-05-22 Thread Scott Wiersdorf
strings or any true/false values will work). Good luck! Scott -- Scott Wiersdorf [EMAIL PROTECTED]