perl joke of the day ? 
Author Message
 perl joke of the day ?

I saw this line in a perl script today...

       if ( length($aString) gt 0 )

--

#include <standard.disclaimer>
RULE #5: When you can say something in a positive way or a negative way,
         don't say it in the negative way.



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Quote:

> I saw this line in a perl script today...
>        if ( length($aString) gt 0 )

Maybe, and just for fun of course, we should add another Perl
programming contest to the pool; we already have the "obfuscated
Perl" programming contest, why not a "how many errors can you
put into a single line of Perl code" contest?  >;-)

Although the contest itself would not be a serious affair, this
proposal is!!

Proposed scheme for evaluating submitted entries:

Turn it into a reasonable line of code and count the number of steps
needed to turn it into the submitted piece of code:

I.e.,

         if ( length($aString) )
         if ( length($aString) > 0 )
         if ( length($aString) gt 0 )

(Also counting unnecessary steps or weird although working constructs
as errors)

What do you think?  >;-)

Yours,
--

     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Does anyone know where I can get a copy of PERL for both VMS and
Windows95' O/S's?

                        JIM

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                Texas Instruments, Inc.
James Patton            Novice Systems Administrator

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Quote:

> I saw this line in a perl script today...

>        if ( length($aString) gt 0 )

Come on, the author was obviously trying to avoid "anti-strings"
with length < 0, due to the drastic results when they come into
contact with regualr strings...

Scott

:-) for the humor-impaired

--
Scott I. Blanks{*filter*}
sib (at) worldnet (dot) att (dot) net



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

[A complimentary Cc of this posting was sent to Scott Blanks{*filter*}


Quote:

> > I saw this line in a perl script today...

> >        if ( length($aString) gt 0 )

> Come on, the author was obviously trying to avoid "anti-strings"
> with length < 0, due to the drastic results when they come into
> contact with regualr strings...

> Scott

> :-) for the humor-impaired

No, there is nothing of humourous nature here, it is easy to produce a
string with a length == -1 in Perl (unless you applied jumbo regexp
patches).  Look on DejaNews for the examples.

Since the test -1 gt 0 is false, the above code may protect around
this bug. ;-)

Ilya



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?


Quote:

> :
> : I.e.,
> :
> :          if ( length($aString) )
> :          if ( length($aString) > 0 )
> :          if ( length($aString) gt 0 )
> :
> : (Also counting unnecessary steps or weird although working constructs
> : as errors)

> You forgot to start with 'if ($aString)'.

No, I didn't.

"if ($aString)" and "if (length($aString))" are not equivalent.

Try both with a string equal to "0" - the length is greater than zero
but the value is FALSE.

Yours,
--

     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Or maybe the guy just needs some help.

Why poke fun at those who are less experienced than yourself?

Can't a newsgroup be educating instead of humiliating. People like you
make this forum a platform for elitist views instead of a free and frank
exchange of ideas.



Sun, 28 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

The best joke perl I've found so far is this
(some names changed to protect the guilty)

if ( (system("cmd")/256) != 0) {
        print "Cmd failed\n";
        exit 1;

Quote:
}

It isn't that funny with the superfluous "!= 0" but the added
useless "/256" makes it a minor classic.

Stuart Cooper



Mon, 29 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Quote:

> ...
> It is easy to produce a string with a length == -1 in Perl (unless you
> applied jumbo regexp > patches).  Look on DejaNews for the examples.

Are the jumbo regexp patches included in 5.004 or is this a 5.003 concern?
I've looked unsuccessfully through the all the Changes files in 5.004.

Pat

--
--------------------------------------------------------

--------------------------------------------------------



Mon, 29 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Quote:


>> It is easy to produce a string with a length == -1 in Perl (unless you
>> applied jumbo regexp > patches).  Look on DejaNews for the examples.
> Are the jumbo regexp patches included in 5.004 or is this a 5.003
> concern?  I've looked unsuccessfully through the all the Changes files
> in 5.004.

The jumbo regex patches have yet, so far as I know, to be included in any
"official" version of Perl, even the current development release.  They're
among the development patches proposed to go into 5.005, however.

--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker





Mon, 29 Nov 1999 03:00:00 GMT  
 perl joke of the day ?

Quote:


> Or maybe the guy just needs some help.

maybe he gave the guy/girl some help...

Quote:
> Why poke fun at those who are less experienced than yourself?

> Can't a newsgroup be educating instead of humiliating. People like you
> make this forum a platform for elitist views instead of a free and frank
> exchange of ideas.

A) I saw no mention of anyone singled out for {*filter*}...
   just an un-attributed snippet of code.
B) How do you know a few 'less experienced' folk out there
   didn't actually learn something (or remind themselves of
   something) as a result of puzzling over that snippet?
C) People like you might make this forum a platform for humourless
   elitist views instead of a free and frank exchange of
   ideas.

regards
andrew



Mon, 29 Nov 1999 03:00:00 GMT  
 perl joke of the day ?


Quote:

> Does anyone know where I can get a copy of PERL for both VMS and
> Windows95' O/S's?

CPAN.

If you don't know where CPAN is, point your browser at URL
http:/www.perl.com/ and look around.

- doug



Tue, 30 Nov 1999 03:00:00 GMT  
 
 [ 22 post ]  Go to page: [1] [2]

 Relevant Pages 

1. PERL to C translator IS A JOKE (APRIL 1st)

2. great jokes!

3. JOKE: Microsoft Innovation

4. What the joke, no host!?

5. Send Joke Script Help!

6. Comp Joke

7. Days between dates, day of week ...

8. Convert Day of Year to Month and Day?

9. from day of year to day, month, year

10. PERL programming - 3 days work offered

11. Italian Perl Workshop 2009 - Call for Papers: last days for submissions

12. Calandaring in perl - Day of month from date?

 

 
Powered by phpBB® Forum Software