[27590] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9109 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 31 14:05:50 2006

Date: Fri, 31 Mar 2006 11:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 31 Mar 2006     Volume: 10 Number: 9109

Today's topics:
        <%><%><%><%>HOW TO BE FUNNY!<%><%><%><%> (Expert Humor)
        <><><><><><><>The Net's #1 Joke e-Book!<><><><><><><><> (Expert Humor)
        >@>@>@>@>GET MORE CHICKS............LEARN GUITAR....... (Expert Humor)
    Re: A Problem With GD <markem@airmail.net>
        exit status <jerry.adair@sas.com>
    Re: exit status <anfi@priv.onet.pl>
    Re: exit status <glex_no-spam@qwest-spam-no.invalid>
    Re: exit status <jgibson@mail.arc.nasa.gov>
    Re: Find duplicates in a dat file <tadmc@augustmail.com>
        multi-line regular expression help <ces@cescom.com>
    Re: multi-line regular expression help <tome@pcdotcom.com>
        Speed of increment operators axel@white-eagle.invalid.uk
        The following week, Graham Cluley - a colleague and emp dpedrocco@randit.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 31 Mar 2006 15:04:54 GMT
From: TheExpert@ExpertHumor.com (Expert Humor)
Subject: <%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
Message-Id: <252244333106@free.teranews.com>

You too can learn to be funny in just 7 days flat:

http://www.ExpertHumor.com/HowToBeFunny.htm








*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***


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

Date: 31 Mar 2006 14:17:28 GMT
From: TheExpert@ExpertHumor.com (Expert Humor)
Subject: <><><><><><><>The Net's #1 Joke e-Book!<><><><><><><><>
Message-Id: <223840233106@free.teranews.com>

That's Comedy - Over 460 Pages of Little Snickers, 
Medium-Sized Chuckles, and Great Big Belly Laughs:

http://www.ExpertHumor.com/That'sComedy.htm





*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***


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

Date: 31 Mar 2006 14:41:23 GMT
From: TheExpert@ExpertHumor.com (Expert Humor)
Subject: >@>@>@>@>GET MORE CHICKS............LEARN GUITAR.............
Message-Id: <238183633106@free.teranews.com>

Chicks dig guitar players.
So get more chicks!
Learn how to play guitar!

http://www.ExpertHumor.com/LearnGuitar.htm












*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***


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

Date: Fri, 31 Mar 2006 11:11:53 -0600
From: Mark Manning <markem@airmail.net>
Subject: Re: A Problem With GD
Message-Id: <122qok8irf0cs5b@corp.supernews.com>

Uri Guttman wrote:

>>>>>>"MM" == Mark Manning <markem@airmail.net> writes:
> 
> 
>   MM> No.  The conversation is not "which version of perl do you have" -
>   MM> it is "where is the most up-to-date version of the documentation".
>   MM> The most up-to-date version will be on-line.  True, the
>   MM> documentation might refer to a different version of Perl but it
>   MM> would still be more current than whatever documentation I might
>   MM> have on my system.
> 
> where can you find the most up to date documentation for your brain?
> 
> the most recent docs on perl are NOT USEFUL for older perls. perl
> doesn't change the docs separately from the source tree. the new docs
> will cover changes, bug fixes, additions, etc that ARE NOT in your older
> perl. it will NOT just be a 'better' or more useful set of docs. being
> current is not the issue, being accurate it. very few doc changes go in
> that are just pure doc edits as they have been reviewed and edited over
> a long period of time by many (hundreds of thousands?) of
> readers/users.
> 
> just trying to explain why your expectations of newer docs being better
> for older perls is a way off target. you can continue to think you are
> correct but you are wrong. changing your views about perl's docs and
> perl's released code is the correct answer.
> 
> uri
> 

No Uri.  We are not talking about a particular version of Perl.  The version 
stuff came from Abigail.  I simply said that the most current version of the 
Perl documentation would be on-line long before you could get it in a release. 
I have further stated that it is not necessary to obtain a new release every 
single time you may encounter something that is different now than it was then.

However, to follow your logic:  Even if the powers that be decided to put in a 
new function to Perl.  (Let's call it CoinFlip.)  You still do not have to 
download the new release of Perl just to be able to read up on CoinFlip. 
Further, as happens all of the time on the net, the new function would appear on 
several sites where they would be talking about CoinFlip, how it is used, 
called, what version it appeared in, and so forth.  Thus, again, the net would 
have more up-to-date information than the documentation I have on my system. 
Whether or not my particular version of Perl is the latest or not.

So, I am afraid, you are stll wrong.  The original question by Abigail was why 
did I first look on-line for the documentation about Perl that she had 
mentioned.  My response was, and still is, because that is where the most 
current documentation would be located and if there had been a change that I was 
unaware of (which I was), then I wanted to read up on it and find out as much as 
I could about the change so that, as Abigail pointed out, I would not wind up 
making a program do things I didn't really want it to do.



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

Date: Fri, 31 Mar 2006 10:37:55 -0500
From: "Jerry Adair" <jerry.adair@sas.com>
Subject: exit status
Message-Id: <e0jicj$ttd$1@foggy.unx.sas.com>

Ok I'll keep with my vane of asking potentially obvious questions.

I am attempting to return an error code from a Perl script.  At first blush, 
it seemed easy with the exit() call.  But it doesn't work.  Just out of 
frustration I tried a return() call, and I got the correct return code, 
albeit with an error message about returning from a non-subroutine.

The code I had was simple enough:

exit(status( <blah blah blah> ));

Thank you in advance.

Jerry 




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

Date: Fri, 31 Mar 2006 17:59:33 +0200
From: Andrzej Adam Filip <anfi@priv.onet.pl>
Subject: Re: exit status
Message-Id: <87fykyd2qi.fsf@anfi.homeunix.net>

"Jerry Adair" <jerry.adair@sas.com> writes:

> Ok I'll keep with my vane of asking potentially obvious questions.
>
> I am attempting to return an error code from a Perl script.  At first blush, 
> it seemed easy with the exit() call.  But it doesn't work.  Just out of 
> frustration I tried a return() call, and I got the correct return code, 
> albeit with an error message about returning from a non-subroutine.
>
> The code I had was simple enough:
>
> exit(status( <blah blah blah> ));

How do you test the value of exit code?
[ What OS do you use? ]

It *works* as expected on my linux:
perl -e 'exit 2' ; echo $?

-- 
[pl2en Andrew] Andrzej Adam Filip : anfi@priv.onet.pl : anfi@xl.wp.pl
http://anfi.homeunix.net/


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

Date: Fri, 31 Mar 2006 10:48:37 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: exit status
Message-Id: <z3dXf.16$bd3.1123@news.uswest.net>

Jerry Adair wrote:
> Ok I'll keep with my vane of asking potentially obvious questions.
> 
> I am attempting to return an error code from a Perl script.  At first blush, 
> it seemed easy with the exit() call.  But it doesn't work.  Just out of 
> frustration I tried a return() call, and I got the correct return code, 
> albeit with an error message about returning from a non-subroutine.
> 
> The code I had was simple enough:
> 
> exit(status( <blah blah blah> ));

Maybe one of these will help:

perldoc -f die
perldoc -f exit
perldoc -f eval
perldoc -f system

It sounds like you should be using die or exit, so the issue seems to be
in how the program that's calling the script is detecting the error. It
should look at the exit status, not what's returned on STDOUT.

If you're still stuck, show us how you're calling the script and how 
you're getting the 'error code'.  A simple one liner that calls the 
script/subroutine that has one line of code (die or exit) should be 
enough to figure it out.


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

Date: Fri, 31 Mar 2006 09:45:21 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: exit status
Message-Id: <310320060945210617%jgibson@mail.arc.nasa.gov>

In article <e0jicj$ttd$1@foggy.unx.sas.com>, Jerry Adair
<jerry.adair@sas.com> wrote:

> Ok I'll keep with my vane of asking potentially obvious questions.

Regardless of weather you get silly puns for answers?

(sometimes I just can't help myself :)

-- 
Jim Gibson


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

Date: Fri, 31 Mar 2006 10:30:03 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Find duplicates in a dat file
Message-Id: <slrne2qm8b.c17.tadmc@magna.augustmail.com>

Dr.Ruud <rvtol+news@isolution.nl> wrote:

> The first two lines of my smaller Perl scripts often look like:

[snip]


The first four lines of all of my Perl programs look like:

#!/usr/bin/perl
# prog_name - what prog_name does
use warnings;
use strict;


Because then when I can't find a program I remember writing
a long time ago, I just run the program below to make an
index of all of my Perl programs.


------------------------------------
#!/usr/bin/perl
# perl_program_index - make an index of all of my Perl programs
use warnings;
use strict;
use File::Find;

@ARGV = '.' unless @ARGV;     # default to current directory

find \&perl_programs, @ARGV;

sub perl_programs {
   return unless -f and -x _ and -T _; # consider only executable text files

   open PROG, $_ or die "could not open '$_'  $!";
   return unless defined(my $shebang = <PROG>);
   return unless defined(my $comment = <PROG>);
   close PROG;

   return unless $shebang =~ /^#!.*perl/;         # not a perl program
   return unless $comment =~ /^#\s*(\w+) - (.*)/; # not properly commented

   print "$2\n   $File::Find::name\n\n";
}
------------------------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 31 Mar 2006 16:46:43 GMT
From: Cesar Baquerizo <ces@cescom.com>
Subject: multi-line regular expression help
Message-Id: <T1dXf.5260$nA3.3663@news-wrt-01.rdc-nyc.rr.com>

Hello,

I am having a problem trying to match both of the following strings:

03/23 THU    07:09A  (b12:00P   b12:30P)   04:30P    8:00   0:00   0:00

as well as (embedded newline):

03/27 MON    07:59A  [ 11:59A    12:44P] (b12:45P
              b01:15P)   04:30P                       8:00   0:00   0:00

The first string always matches, but the second never matches.  I've 
tried different incarnations of the following regex with no success:

(/^\s*\d\d\/\d\d\s+[A-Z][A-Z][A-Z]\s+.*\d\:\d\d\s+\d\:\d\d\s*$/ms)
                                      ^^

I was hoping that the above part (.*) would match a newline or anything 
else in this case and return it in $&.

Any help appreciated.

Thanks


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

Date: Fri, 31 Mar 2006 13:51:41 -0500
From: Tome <tome@pcdotcom.com>
Subject: Re: multi-line regular expression help
Message-Id: <mauq22psp25gg1fagmu6lnpt6ki294sqcn@4ax.com>

I copied and pasted your regex as well as your string and it worked with no problem:

$string = "03/27 MON    07:59A  [ 11:59A    12:44P] (b12:45P
              b01:15P)   04:30P                       8:00   0:00   0:00";
print "$&\n" if $string =~ /^\s*\d\d\/\d\d\s+[A-Z][A-Z][A-Z]\s+.*\d\:\d\d\s+\d\:\d\d\s*$/ms;

It definitely succeeded in the match and printed it fine.  .* will match newlines as long as you
have /s.

Maybe if you post your code we can find the problem.

---Tome

On Fri, 31 Mar 2006 16:46:43 GMT, Cesar Baquerizo <ces@cescom.com> wrote:

>Hello,
>
>I am having a problem trying to match both of the following strings:
>
>03/23 THU    07:09A  (b12:00P   b12:30P)   04:30P    8:00   0:00   0:00
>
>as well as (embedded newline):
>
>03/27 MON    07:59A  [ 11:59A    12:44P] (b12:45P
>              b01:15P)   04:30P                       8:00   0:00   0:00
>
>The first string always matches, but the second never matches.  I've 
>tried different incarnations of the following regex with no success:
>
>(/^\s*\d\d\/\d\d\s+[A-Z][A-Z][A-Z]\s+.*\d\:\d\d\s+\d\:\d\d\s*$/ms)
>                                      ^^
>
>I was hoping that the above part (.*) would match a newline or anything 
>else in this case and return it in $&.
>
>Any help appreciated.
>
>Thanks


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

Date: Fri, 31 Mar 2006 14:25:06 GMT
From: axel@white-eagle.invalid.uk
Subject: Speed of increment operators
Message-Id: <6ZaXf.45464$wl.9333@text.news.blueyonder.co.uk>

Dr.Ruud <rvtol+news@isolution.nl> wrote:
> The first two lines of my smaller Perl scripts often look like:
 
> #!/usr/bin/perl
> use strict; use warnings; ++$|;
 
On a slightly different track, is there any different in execution
speed between ++$i and $i++ in Perl. I seem to remember that there
was such a difference in C++ but may be mistaken.

Axel


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

Date: Fri, 31 Mar 2006 02:23:03 +0200
From: dpedrocco@randit.com
Subject: The following week, Graham Cluley - a colleague and employee of Solomon
Message-Id: <9ae19c44@8a90318.com>




The following week, Graham Cluley - a colleague and employee of Solomon




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9109
***************************************


home help back first fref pref prev next nref lref last post