Re: Matching at least $x words out of @words

2005-05-09 Thread Sven Neuhaus
On Thu, May 05, 2005 at 03:24:22PM +0100, José Castro wrote: So suppose you want a regular expression to match at least one of three words: /word1|word2|word3/ What solution would you use if you wanted at least _two_ of those three words? Isn't there a neater (and probably twisted, of

Re: lwall snippet

2004-04-11 Thread Sven Neuhaus
On Sat, Apr 10, 2004 at 08:56:26PM -0400, [EMAIL PROTECTED] wrote: I recently came across this impenetrable Wall code: last|perl -pe '$_ x=/(..:..)...(.*)/'$1'ge$1'$1'lt$2' That's gonna be tough for Randal to beat... :-) -- Larry Wall in [EMAIL PROTECTED] What on earth

Re: Longest Common Substring

2002-02-14 Thread Sven Neuhaus
Am Don, 2002-02-14 um 17.18 schrieb Daniel R. Allen: finding the longest common (consecutive) substring Here is a very straightforward approach (C-ish). All found substrings are saved in a hash (this part could be optimized/replaced easily)... sub common($$) { my($x, $y) = @_; my

Re: STDERR

2002-01-28 Thread Sven Neuhaus
Am Son, 2002-01-27 um 18.34 schrieb Bill -OSX- Jones: Isn't there another var that is the same as STDERR ? If you use English; you can use $OS_ERROR or $ERRNO. They will be the same as $!. -Sven

Re: test a password string for correctness

2001-12-13 Thread Sven Neuhaus
On Thu, Dec 13, 2001 at 02:36:38PM +0100, Bart Lateur wrote: On Thu, 13 Dec 2001 14:29:14 +0100, Kim Schulz wrote: How short kan you make a program (oneliner?) that: * checks if a password is 5 characters long or more * checks if the password contains at least 3 alpha chars (a-zA-Z) * checks

Re: test a password string for correctness

2001-12-13 Thread Sven Neuhaus
On Thu, Dec 13, 2001 at 03:01:43PM +, Mohit Agarwal wrote: On Thu, Dec 13, 2001 at 02:49:05PM +0100, Sven Neuhaus wrote: y/A-Za-z/A-Za-z/2y/0-9/0-9/1 or the shorter $a=$_;y/A-Za-z//2y/0-9//1 that will mungle the password in $_ but keep a good copy in $a. Why

Re: tri-state flags

2001-12-05 Thread Sven Neuhaus
On Wed, Dec 05, 2001 at 10:43:14AM +0100, Sven Neuhaus wrote: On Wed, Dec 05, 2001 at 04:32:49AM -0500, Michael G Schwern wrote: On Wed, Dec 05, 2001 at 03:30:07AM +0100, Bart Lateur wrote: I often use tri-state flags, with possible value true (1), false (0), or undetermined (undef

Re: tri-state flags

2001-12-05 Thread Sven Neuhaus
On Wed, Dec 05, 2001 at 04:56:34AM -0500, Michael G Schwern wrote: On Wed, Dec 05, 2001 at 10:43:14AM +0100, Sven Neuhaus wrote: Looks like ~ doesn't trigger a warning on undef. So ~$a ? $a ? 3 : 2 : 1 will yield 3 for true, 2 for false, 1 for undef. That's no good, repetition

Re: World's shortest JAPH (was: first)

2001-08-22 Thread Sven Neuhaus
On Wed, Aug 22, 2001 at 10:15:46AM +0100, Ian Phillipps wrote: What *is* the world's shortest JAPH, anyway? I would be disappointed if it were just 'print ' Depends on how much you want to cheat (we've had this discussion before). If you have netcat installed as 'nc' in your path, you can