[21845] in Perl-Users-Digest
Perl-Users Digest, Issue: 4049 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 30 18:05:54 2002
Date: Wed, 30 Oct 2002 15:05:11 -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 Wed, 30 Oct 2002 Volume: 10 Number: 4049
Today's topics:
*** PERL monitor script...*** <igabrie@mis.gla.ac.uk>
Re: amateur socketeer: long wait (Leaffoot)
Can someone look at this for loop? (Rob)
Re: Can someone look at this for loop? <pinyaj@rpi.edu>
Re: Can someone look at this for loop? <trammell+usenet@hypersloth.invalid>
Re: Can someone look at this for loop? <jhalpin@nortelnetworks.com_.nospam>
Re: Can someone look at this for loop? <ak@freeshell.org.REMOVE>
Re: Creating a Microsoft Word file with Win32::OLE <cawong@cisco.com>
cron and sendmail - body of message missing?!?... (Chris Milkosky)
Re: cron and sendmail - body of message missing?!?... <dover@nortelnetworks.com>
getting data out of database for downloading (Hans)
Re: Help understanding Perl logic <mike_constant@yahoo.com>
Re: How can I remove null entires from an array? <wksmith@optonline.net>
How to trap carp? <heather710101@yahoo.com>
Re: Limit output of examine (x) and return (r) in debug (Mark Jason Dominus)
Re: Limit output of examine (x) and return (r) in debug <nospam-abuse@ilyaz.org>
Re: More Efficient Way To Get Last Line From A TXT File <bkennedy@hmsonline.com>
Open a HTML page not using redirect <tim@nonspam_melonhead.net>
Re: Open a HTML page not using redirect <ihave@noemail.com>
Re: Open a HTML page not using redirect <jeff@vpservices.com>
Re: Open a HTML page not using redirect <ihave@noemail.com>
Re: Pascal comment RE (Andrew Perrin (CLists))
Re: significance of 42 for perl, any?!? <bik.mido@tiscalinet.it>
Re: whatever happened to "static typing hints"? <goldbb2@earthlink.net>
Re: while vs. foreach <ak@freeshell.org.REMOVE>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 Oct 2002 15:57:55 +0000
From: inderjit s gabrie <igabrie@mis.gla.ac.uk>
Subject: *** PERL monitor script...***
Message-Id: <3DC00183.FDAA946@mis.gla.ac.uk>
Hi all
I am just starting out in perl/cgi scripting...i have done some simple
programs , what i want to do is to have a 'system status' web page which
has all of our unix box names on it...what i want is a perl script that
i can embed into html to monitor these two unix systems, any alerts or
if they crash i want this system staus webpage to show the system
staus, can this be done...or is there any perl/cgi script that can do
the job ....thanks in advance...indy
------------------------------
Date: 30 Oct 2002 10:01:04 -0800
From: leaffoot@hotmail.com (Leaffoot)
Subject: Re: amateur socketeer: long wait
Message-Id: <d7bd06a3.0210301001.7ac28b1f@posting.google.com>
Wow, sometimes I can't believe this kind of code help is free. Thanks
for all your comments. Let's see..
> > sub sendstr {
> > # pass in socket and string to send
> > my @args = @_;
> > my $sock = shift @args;
> > my $str = shift @args;
> >
> > print $sock "$str" || confess "I can't send the str $str!\n";
> > return 1;
> > }
>
> I note that here, you're using 'print $sock' ... print does output
> buffering.
-- Well, yes, and I would have used a simple print statement for the
retrieve, too, to STDOUT, but the send worked and the retrieve didn't,
when I had it coded that way.. that's why I ended up writing something
with syswrite, because I found it to be effective. Maybe because I
didn't have autoflush on, the simple way wasn't working for me. I
will try that on the retrieval.
> Also... you've got a precedence error -- the print statement parses as:
>
> print $sock ("$str" || confess "I can't send the str $str!\n");
>
> Which is not likely what you want. Change it to:
>
> print $sock "$str" or confess "I can't send the str $str!\n";
-- Yes, thanks for catching that.
> > my $time_start = new Benchmark;
>
> Although there's nothing really *wrong* with the indirect object syntax
> (method target(args)), you code will be more readable, and less prone to
> subtle errors, if you always use the direct object syntax
> (target->method(args)) ... so, you might want to write this as:
>
> my $time_start = Benchmark->new;
>
> It's your choice, though... TIMTOWTDI
-- ok.. I'll consider that!
> > while($length_l = sysread $sock, $comeback_l, $len) {
>
> This would be a good place to declare $length_l, $comeback_l, and $len.
>
> > if(!defined $length_l) {
> > confess "System read error: $!\n";
> > }
>
> You're only inside the while loop when $length_l is true. If it were
> undefined, it would be false, and fall out of the loop.
>
> So this needs to be *after* the while loop.
-- true, thanks, someone else saw that too.
> Is there any reason why you don't simply 'print STDOUT $comeback_l;' ?
> Of course, you might want to do STDOUT->autoflush(1) at some earlier
> point in your program, but that's minor.
-- I mentioned this above, but now that I know about autoflush, I
might have more success.
> > if ($comeback_l =~ m/END OF REPORT/) {
> > last;
> > }
> > if ($comeback_l =~ m/^\d+CERRUR\d+.*/) {
> > last;
> > }
>
> These could be combined into one expression:
>
> last if $comeback_l =~ /^\d+CERRUR\d|END OF REPORT/;
>
-- True, and done.
> > my $time_end = new Benchmark;
> > my $this_time = timediff($time_end, $time_start);
>
> The $time_start variable was set before entering the loop... if you go
> through the loop twice, $this_time won't be the time for this most
> recent sysread, but will be the sum of the times for both sysreads.
>
> > my $timestr = timestr($this_time);
> > print "Time taken to send & retrieve: ", timestr($this_time),
> > "\n";
> > if($timestr =~ m/\b(\d+) wallclock secs/) {
> > if($1 > 50) {
> > close($sock);
> > $flag = 1;
> > last;
> > }
> > }
>
> It looks like you're trying to time things out after 50 seconds...
> But if the last sysread itself takes more than that, or blocks
> indefinitely, you've got a problem. Perhaps you should be using
> IO::Select?
-- Now, this one I'm not sure I understand. I did intentionally have
the new benchmark as the sum of the sysreads.. I don't anticipate any
single transaction taking much longer than 8 seconds. And it was my
intention to try to get out after 50 seconds, because at times I was
seeing an indefinite-pause that lasted close to 10 minutes. Maybe I
*should* be using io::select. I'll look in to it.
Thanks!
Becka
------------------------------
Date: 30 Oct 2002 12:53:15 -0800
From: rob835@hotmail.com (Rob)
Subject: Can someone look at this for loop?
Message-Id: <6841b10c.0210301253.708fbd44@posting.google.com>
I am still sort of new to perl but I thought I was way past this.
This one has me stumped.
#### Here is the code I have narrowed down:
use strict;
use warnings;
my $index_counter = 0;
for ($index_counter = 0, $index_counter <= 7, $index_counter++) {
print "index counter was $index_counter\n";
} #for ($index_counter = 0, $index_counter <= 7, $index_counter++)
### End code section
Here is the output I am getting:
D:\>perl -w testing.pl
index counter was 1
index counter was 1
index counter was 1
D:\>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 631 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 17:16:22 Jan 2 2002
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
Also I'm using Win2k.
Thanks for the input,
Rob
------------------------------
Date: Wed, 30 Oct 2002 15:59:13 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Rob <rob835@hotmail.com>
Subject: Re: Can someone look at this for loop?
Message-Id: <Pine.A41.3.96.1021030155839.15696A-100000@cortez.sss.rpi.edu>
[posted & mailed]
On 30 Oct 2002, Rob wrote:
>for ($index_counter = 0, $index_counter <= 7, $index_counter++) {
Those commas should be semicolons.
for (PRE; CONDITION; POST) { ... }
--
Jeff "japhy" Pinyan RPI Acacia Brother #734 2002 Acacia Senior Dean
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: Wed, 30 Oct 2002 21:05:55 +0000 (UTC)
From: John Joseph Trammell <trammell+usenet@hypersloth.invalid>
Subject: Re: Can someone look at this for loop?
Message-Id: <slrnas0idj.7di.trammell+usenet@bayazid.el-swifto.com>
On 30 Oct 2002 12:53:15 -0800, Rob <rob835@hotmail.com> wrote:
> for ($index_counter = 0, $index_counter <= 7, $index_counter++) {
^ ^
I think you mean ';'. Or even better:
foreach my $i (0..7) { ... }
'perldoc perlsyn' for more details.
------------------------------
Date: 30 Oct 2002 15:13:14 -0600
From: Joe Halpin <jhalpin@nortelnetworks.com_.nospam>
Subject: Re: Can someone look at this for loop?
Message-Id: <yxs7pttrljf9.fsf@nortelnetworks.com_.nospam>
rob835@hotmail.com (Rob) writes:
> I am still sort of new to perl but I thought I was way past this.
> This one has me stumped.
>
> #### Here is the code I have narrowed down:
>
> use strict;
> use warnings;
>
> my $index_counter = 0;
>
> for ($index_counter = 0, $index_counter <= 7, $index_counter++) {
Should be
for ($index_counter = 0; $index_counter <= 7; $index_counter++) {
Note semicolons rather than commas.
Joe
------------------------------
Date: Wed, 30 Oct 2002 21:22:46 -0000
From: Andreas =?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE>
Subject: Re: Can someone look at this for loop?
Message-Id: <slrnas0jce.72t.ak@otaku.freeshell.org>
Submitted by "Rob" to comp.lang.perl.misc:
> I am still sort of new to perl but I thought I was way past this.
> This one has me stumped.
>
> #### Here is the code I have narrowed down:
>
> use strict;
> use warnings;
>
> my $index_counter = 0;
Useless initialization.
>
> for ($index_counter = 0, $index_counter <= 7, $index_counter++) {
The for-loop syntax in Perl is the same as in C and as in C++:
for (init; cond; incr) { statements }
I.e., use ';' instead of ','.
--
Andreas Kähäri --==::{ Have a Unix: netbsd.org
--==::{ This post ends with :wq
------------------------------
Date: Wed, 30 Oct 2002 11:28:27 -0800
From: Calvin Wong <cawong@cisco.com>
Subject: Re: Creating a Microsoft Word file with Win32::OLE
Message-Id: <3DC032DB.93239E65@cisco.com>
The examples that I looked at are from this website.
http://www.suite101.com/article.cfm/perl/89607
Calvin
Jay Tilton wrote:
> Calvin Wong <cawong@cisco.com> wrote:
>
> : Can someone please post a simple code to use Microsoft
> : word to open a new document, place "hello world" in it, save
> : the file, and then close Microsoft word.
>
> Share the code you already have, even if it falls short of the goal.
------------------------------
Date: 30 Oct 2002 08:07:28 -0800
From: cmilkosk@comcast.net (Chris Milkosky)
Subject: cron and sendmail - body of message missing?!?...
Message-Id: <c1fe2478.0210300807.7ec978b0@posting.google.com>
Hello!
Sorry if this has been covered before, but searches through the
newsgroups don't appear to be giving me the answer I'm looking for.
I have a perl script that opens a pipe to sendmail to send mail. And
no, using a nice module (which would make sense) is not an option - so
I can't do that...
open(SENDMAIL,"|/usr/lib/sendmail -t") || die "Couldn't open sendmail
to write message\n";
I write out the header with statements similar to:
print SENDMAIL "From: Me <me\@somewhere.com>\n";
etc. etc... and then I end with:
print SENDMAIL ".\n";
close(SENDMAIL);
I run the script, and it runs fine from the commandline, but when I
plop it in cron, the body is missing! Has anyone encountered
something like this before? Any ideas why the header would be
accepted, but the body would disappear when I run it as a cron job?
BTW, this is on a Solaris 5.5 host.
Any help is REALLY REALLY appreciated. =)
Thanks,
Chris
------------------------------
Date: Wed, 30 Oct 2002 11:10:12 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: cron and sendmail - body of message missing?!?...
Message-Id: <app3mc$6j1$1@bcarh8ab.ca.nortel.com>
"Chris Milkosky" wrote...
>
> I run the script, and it runs fine from the commandline, but when I
> plop it in cron, the body is missing!
I've had problems using cron in the past due to its not picking up all
of my normal environment settings. You might try using 'at' instead,
which does copy your environment as part of the setup for execution.
If that doesn't do it, you'll need to show more of your script.
------------------------------
Date: 30 Oct 2002 12:09:50 -0800
From: baga@gmx.de (Hans)
Subject: getting data out of database for downloading
Message-Id: <82c43464.0210301209.65d84b6a@posting.google.com>
Hello,
I have different types of data (like little images, pfd-documents
etc.) saved in a mysql-database.
Now I would like to build a website in perl with download-links for
these data. Is there a way to do this (direct way out of mysql to
download)?
Thanks,
Hans
------------------------------
Date: Wed, 30 Oct 2002 12:03:32 -0800
From: "Newbie" <mike_constant@yahoo.com>
Subject: Re: Help understanding Perl logic
Message-Id: <appdto$3rf9i$1@ID-161864.news.dfncis.de>
"Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
message news:slrnarvrdo.hhh.bernard.el-hagin@gdndev25.lido-tech...
> In article <YQRv9.46$CR7c.20578326@news2.randori.com>, TBN wrote:
> > It works fine, but then I realized some lines have unwanted trailing
spaces
> > as well, so I modified it to...
> > open (STUFF, $filespec);
> > while (<STUFF>) { chomp; push(@myarray,$_=~ s/[ ]+$//); }
> > close (STUFF);
>
> You have a very weird style of writing code. I'd call it lack of
> style, even. :) Isn't the following easier on the eyes:
It's a matter of preferences. This coding style is fine as long as there's
not much in the block. I bet anyone checkin' out "select" man page has seen
this
in one line by Tom Christensen whose coding style is known to be nice
my $fh = select(FOO); $| = 1; select($fh);
------------------------------
Date: Wed, 30 Oct 2002 17:10:42 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: How can I remove null entires from an array?
Message-Id: <moUv9.30799$TH6.25581@news4.srv.hcvlny.cv.net>
"Melonhead" <tim@melonhead.remove.net> wrote in message
news:1035968837.82677.0@iapetus.uk.clara.net...
> My program reads from a | delimited file and stores the values in @emails.
> Quite often some the fields will be empty, i.e. the file will be
> x@abc.com|||b@123.com||me@home.com etc. For other reasons the blank
fields
> in the file must remain so I need a way of removing them from the array.
>
--snip--
Assuming that every pipe character is separator, there is no reason to store
the blank fields
in the array. Leave them in the original string.
#! c:\perl\bin\perl.exe -w
use strict;
local $_ = 'x@abc.com|||b@123.com||me@home.com';
my @emails = m/([^|]+)/g;
print "$#emails\n";
print join('?', @emails), "\n";
Bill
------------------------------
Date: Wed, 30 Oct 2002 21:25:55 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: How to trap carp?
Message-Id: <appip3$ge6$1@reader1.panix.com>
Is there a way to trap carp errors? eval doesn't seem to do it:
use Carp;
eval { die "no problem" };
eval { carp "goes through" };
__END__
% perl -w test_carp.pl
goes through at test_carp.pl line 4
eval {...} called at test_carp.pl line 4
Thanks,
hk
------------------------------
Date: Wed, 30 Oct 2002 16:33:23 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Limit output of examine (x) and return (r) in debugger.
Message-Id: <app1kj$trf$1@plover.com>
Keywords: Halley, Pickering, attribute, slippery
In article <phfvrugv9olne9emrk6hrepdd2fm4b1ard@4ax.com>,
Teh (tî'pô) <teh@mindless.com> wrote:
>My question is, is there a way to tell 'x' I only want to follow a
>certain number of levels.
According to the manual:
x [maxdepth] expr
...
The output format is governed by multiple options
described under "Configurable Options".
If the "maxdepth" is included, it must be a numeral
N; the value is dumped only N levels deep, as if the
"dumpDepth" option had been temporarily set to N.
Note 'maxdepth'.
However, this is only available in Perl version 5.7.3 and later.
------------------------------
Date: Wed, 30 Oct 2002 22:29:29 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Limit output of examine (x) and return (r) in debugger.
Message-Id: <appmg9$n9t$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Teh (tî'pô)
<teh@mindless.com>], who wrote in article <phfvrugv9olne9emrk6hrepdd2fm4b1ard@4ax.com>:
> I'm working on a project with rather large data structures, that is
> many objects hold references to other objects which also hold
> references to still more objects.
>
> My question is this, while using the debugger, when I want to examine
> an object using the 'x' or when I'm in a function that returns an
> object and I type 'r' I get tons of stuff printed to my terminal. Not
> only does this slow me down (it may take up to dozens of seconds each
> time) but it also loses all my buffered lines in the xterm.
>
> If I hit ^C as I would in a C[++] debugger the debugger exits.
It should not. I tried it with
x (0..10000)
and it does not. (Both 5.005_53 and 5.6.1 I have nearby.)
Ilya
------------------------------
Date: Wed, 30 Oct 2002 12:47:37 -0500
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: More Efficient Way To Get Last Line From A TXT File
Message-Id: <oj6dndCnPdHrhl2gXTWcqQ@giganews.com>
"Johnny Lim" <jlim30@hotmail.com> wrote in message
news:1jauru8uq63eal84k46c29covglkofmknf@4ax.com...
>
> @CSVData = <CSVFILE>;
> chomp( @CSVData );
> @CSVLastLine = split /,/, $CSVData[ $#CSVData ];
>
> Is there anyway i can improve the last three lines of the above code and
not
> using ARRAY to store all the contents of the file?
When you evaluate a filehandle in scalar context, you will get the next line
of the file, or undef if there are no more lines. For example:
my $next_line_in_file = <CSVFILE>;
This is the most common way of using file handles, as "slurping" does not
scale very well. Look at the "I/O Operators" section in "perldoc perlop".
Something that would work for you is:
my $last_line; # this will hold the last line successfully read
while(<CSVFILE>) { # cycle through whole file
$last_line = $_; # the data returned by <CSVFILE> is stored in $_
}
print "> Last line: $last_line\n";
--Ben Kennedy
------------------------------
Date: Wed, 30 Oct 2002 18:04:21 -0000
From: "melonhead" <tim@nonspam_melonhead.net>
Subject: Open a HTML page not using redirect
Message-Id: <1036001062.5119.0@iapetus.uk.clara.net>
Hi, is there are method similar to print "Location: www.abc.com\n\n"; that
will open a HTML page but in a seperate window? Say for example I have a
HTML form that when submitted validates the data. If some of that data is
wrong I would like to popup another window with a suitable error message.
Don't really want to use Javascript, but can't figure out how output without
overwritting the existing window.
regards
------------------------------
Date: Wed, 30 Oct 2002 19:16:59 GMT
From: "TBN" <ihave@noemail.com>
Subject: Re: Open a HTML page not using redirect
Message-Id: <HeWv9.63$CR7c.25690254@news2.randori.com>
"melonhead" <tim@nonspam_melonhead.net> wrote in message
news:1036001062.5119.0@iapetus.uk.clara.net...
> Hi, is there are method similar to print "Location: www.abc.com\n\n"; that
> will open a HTML page but in a seperate window? Say for example I have a
> HTML form that when submitted validates the data. If some of that data is
> wrong I would like to popup another window with a suitable error message.
> Don't really want to use Javascript, but can't figure out how output
without
> overwritting the existing window.
>
Where is the validation taking place? On the server with Perl? If so, then
the returned results will be in the same window as the submitted form. Have
you considered validating with the JavaScript which would reduce network
traffic and server workload and would allow you to create a variety of
"popups" dynamically if necessary.
------------------------------
Date: Wed, 30 Oct 2002 11:48:31 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Open a HTML page not using redirect
Message-Id: <3DC0378F.8070208@vpservices.com>
TBN wrote:
> "melonhead" <tim@nonspam_melonhead.net> wrote in message
> news:1036001062.5119.0@iapetus.uk.clara.net...
>
>>Hi, is there are method similar to print "Location: www.abc.com\n\n"; that
>>will open a HTML page but in a seperate window? Say for example I have a
>>HTML form that when submitted validates the data. If some of that data is
>>wrong I would like to popup another window with a suitable error message.
>>Don't really want to use Javascript, but can't figure out how output
>>
> without
>
>>overwritting the existing window.
>>
>>
>
> Where is the validation taking place? On the server with Perl? If so, then
> the returned results will be in the same window as the submitted form.
Not necessarily. The results will go to wherever the TARGET tag of the
form is aimed at or wherever the page's base TARGET is aimed at. Those
targets may or may not be the same window the form was submitted from.
> Have
> you considered validating with the JavaScript which would reduce network
> traffic and server workload and would allow you to create a variety of
> "popups" dynamically if necessary.
Javascript validation will do nothing to validate or protect against
data that is submitted to the script from someone using their own
version of the form (which is something that is easy for anyone to do
and that the script author has no control over).
--
Jeff
------------------------------
Date: Wed, 30 Oct 2002 21:08:12 GMT
From: "TBN" <ihave@noemail.com>
Subject: Re: Open a HTML page not using redirect
Message-Id: <YSXv9.69$CR7c.26280064@news2.randori.com>
[snipped]
> > Where is the validation taking place? On the server with Perl? If so,
then
> > the returned results will be in the same window as the submitted form.
>
>
> Not necessarily. The results will go to wherever the TARGET tag of the
> form is aimed at or wherever the page's base TARGET is aimed at. Those
> targets may or may not be the same window the form was submitted from.
Good point, I forgot about that, but that's outside scope since it still
won't return results to a designated popup window that has not yet been
created. One could create a popup upon submission so that the results could
be sent to the popup, but it sounds as if the user wouldn't want to create a
popup if all was successful, only if an error is encountered.
>
> > Have
> > you considered validating with the JavaScript which would reduce network
> > traffic and server workload and would allow you to create a variety of
> > "popups" dynamically if necessary.
>
>
> Javascript validation will do nothing to validate or protect against
> data that is submitted to the script from someone using their own
> version of the form (which is something that is easy for anyone to do
> and that the script author has no control over).
OK, assuming you have nice users, JS will generally do the trick. Should
the developer totally abandon server-side validation? Hell no, never. I'm
merely suggesting that what the poster is trying to do is exactly what
JavaScript was designed for... taking care of the majority of form
validation on the client side to reduce traffic and workload for the server.
The server should also validate, but if the JS is doing it's job, the server
will only have to do it once and should never have to return an error. On
the off chance that the JS fails or that the user is attempting to
circumvent the JS, then the user may just have to tolerate the error message
appearing in the submission window as opposed to a popup window.
-TBN
------------------------------
Date: 30 Oct 2002 09:44:37 -0500
From: clists@perrin.socsci.unc.edu (Andrew Perrin (CLists))
Subject: Re: Pascal comment RE
Message-Id: <84lm4gkmui.fsf@perrin.socsci.unc.edu>
fredrik.andersson@avionics.saab.se (Fredrik Andersson) writes:
> [snip]
> ^\(\*.*\*\)
> A line that only contains a Pascal comment (* text *)
How about:
/^\s*\(\*.*\*\)\s*$/
It works for me on a cursory test, but I haven't tried it out thoroughly.
ap
--
----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
------------------------------
Date: Wed, 30 Oct 2002 22:35:28 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: significance of 42 for perl, any?!?
Message-Id: <mp7tru48ukmha3498ljr0e04b71c7hrtsj@4ax.com>
On Tue, 29 Oct 2002 13:32:42 GMT, helgi@decode.is (Helgi Briem) wrote:
>>>> > Is there any particular significance of 42 for perl or is it just my impression?
>>>>
>>>> Its the answer to the question about Life, the Universe, and Everything. We
>>>> don't know what the question is, but when we do, its answer will be 42.
>>>
>>> I thought the question was, 'What is 8x7?'
>>
>>AFAIK, 8x7 is "8888888". You probably meant 8*7.
>
>AFAIK, you are both wrong. 8*7 is not 42. 6*7 is.
This thread is becoming definitely instructive at last!! :-)
BTW: thanks for the answers.
Michele
--
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
[Dante Alighieri, Purg. I, 71-72]
I am my own country - United States Confederate of Me!
[Pennywise, "My own country"]
------------------------------
Date: Wed, 30 Oct 2002 18:04:57 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: whatever happened to "static typing hints"?
Message-Id: <3DC06599.6E85F93@earthlink.net>
Teh (tî'pô) wrote:
>
> Benjamin Goldberg bravely attempted to attach 44 electrodes of
> knowledge to the nipples of comp.lang.perl.misc by saying:
> >Tassilo v. Parseval wrote:
>
> >> Anyway, since strict type checking would certainly be optional
> >> there's not much to complain about. It's just an additional feature
> >> that would be useful in a lot of situations (perhaps even as a run
> >> time optimization).
> >
> >I dunno... a compile-time optomization could be done. Eg, suppose
> >that if you have:
> > my Dog $spot = ...;
> > $spot->bark(@args);
> >It does Dog->can('bark') at compile time, stores that sub in the
> >optree, and effectively does:
> > Dog->can('bark')->($spot, @args);
>
> Won't that go kabloee if someone fiddles with @Dog::ISA ? (if bark's
> defined in a base class).
Yes, it would ... unless at the first use of this optomization,
@Dog::ISA, and the @ISA's of all parent classes, get made read-only.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Wed, 30 Oct 2002 21:00:59 -0000
From: Andreas =?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE>
Subject: Re: while vs. foreach
Message-Id: <slrnas0i3j.p3m.ak@otaku.freeshell.org>
Submitted by "Steven Smolinski" to comp.lang.perl.misc:
> Andreas Kähäri <ak@freeshell.org.REMOVE> wrote:
>
>> You're modifying the contents of the array as you iterate over
>> it. Instead, you should have done the equivalent of
>>
>> use strict;
>> my @arr = qw( a b c d e f g h i );
>> foreach (@arr) {
>> print;
>> }
>
> There is always:
>
> print @arr;
To simplify this particular example, yes.
--
Andreas Kähäri --==::{ Have a Unix: netbsd.org
--==::{ This post ends with :wq
------------------------------
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.
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 4049
***************************************