[7096] in Perl-Users-Digest
Perl-Users Digest, Issue: 721 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 11 11:17:39 1997
Date: Fri, 11 Jul 97 08:00:46 -0700
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, 11 Jul 1997 Volume: 8 Number: 721
Today's topics:
Re: /x /s ......problem (Gerben Vos)
[Q] CGI.pm install <martini@invision.net>
[Q] CGI_Lite v1.7 <martini@invision.net>
A Quick One re; $| <pdenman@ims.ltd.uk>
Are the perl modules for Win32 compiled and available? (Mark Nielsen)
bug in MailTools package? <tpo@NoSpam.spin.ch>
Re: Exporting Variables...again <Torsten.Naumann@informatik.tu-chemnitz.de>
Re: Gen. a random no. (within range) (Shane)
Re: Global Vars : Why would I want to use "use strict" <zenin@best.com>
Re: How do I lock a file in MacPerl? <neeri@iis.ee.ethz.ch>
How to substract a uniq integer from a ASCI string (Toutatis)
Re: Linking old and new DBD-Oracle 32-bit object togeth (Lamont Alan Lucas)
mixing up a list (Shane)
Re: mixing up a list (Tad McClellan)
Newbie Win95 Perl Q (Michael Boswell)
OLE Automation fails <thomas.hoffmann@zentrale.adac.de>
Re: online tutorial <uma@heidelbg.ibm.com>
Re: Output to a file (David Zeng)
Re: PERL Book <ajohnson@gpu.srv.ualberta.ca>
Re: Perl function STDERR send to STDOUT ??? (Charles DeRykus)
Re: Perl is 20 times slower on Cray J90 than SGI! <justinb@cray.com>
Re: Problem writing to binary file (Even Holen)
Re-Install man pages properly (Danny Aldham)
Re: regex break out of while loop broken? <ajohnson@gpu.srv.ualberta.ca>
resolving relative paths? <tmh@possibility.com>
shift on an empty array returns ( undef ) in a list con (Ivan Kohler)
Sorting List of Lists (Robert Maguire)
Re: Stripping text from a file (Greg Bacon)
Re: time function for subsecond measurements (Edward J. Sabol)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jul 1997 13:46:39 GMT
From: gerben@cs.vu.nl (Gerben Vos)
Subject: Re: /x /s ......problem
Message-Id: <5q5dfv$etf@star.cs.vu.nl>
Fan Ng writes:
>I don't know that what is the slash follow a character means.
>just like /x or /s .......
>But i know \s or \n or \w.......means.
>Can someone tell me that where are they different. and where use the /x /s
They modify a match or substitution operator. For example, /test/i
matches all of "test", "TEST" and "TeSt", because /i means "ignore case".
There are many more, read the perlop and perlre manual pages.
. . . . . . . . . . . . . . . . . . . . . . . . . . . G e r b e n V o s <><
mailto:gerben@cs.vu.nl http://www.cs.vu.nl/%7Egerben/
Ceci n'est pas une .signature .
------------------------------
Date: Tue, 8 Jul 1997 13:43:47 -0400
From: Matt Martini <martini@invision.net>
Subject: [Q] CGI.pm install
Message-Id: <Pine.AUX.3.95.970708134250.2439A-100000@scarlet.invision.net>
I am installing modules into my newly compiled Perl 5.004. I am a little
confused about the CGI.pm module:
I installed CGI-modules-2.76 without a problem. Then I tried to install
CGI.pm-2.34. I received the following error messages:
## Differing version of ./CGI.pm found. You might like to
rm /usr/local/lib/perl5/./CGI.pm
## Differing version of CGI/Push.pm found. You might like to
rm /usr/local/lib/perl5/./CGI/Push.pm
## Running 'make install UNINST=1' will unlink all those files for you.
Should have I installed CGI.pm-2.34? Is this an older version of the one in
CGI-modules-2.76? should I reverse the order of their installation?
I ran the 'make install UNINST=1' as instructed but I'm not sure if the
results are what I want. I now have a CGI directory outside the site-perl
directory.
Am I ok?, or should I uninstall one of the modules? (how do you uninstall a
module?)
Thanks for the help,
Matt
___________________________http://www.invision.net/________________________
Matthew E. Martini, PE InVision, LLC. (516) 543-1000
Chief Technical Officer matt@invision.net (516) 864-8896 Fax
_______________________________________________________________________pgp_
------------------------------
Date: Tue, 8 Jul 1997 13:45:49 -0400
From: Matt Martini <martini@invision.net>
Subject: [Q] CGI_Lite v1.7
Message-Id: <Pine.AUX.3.95.970708134435.2439C-100000@scarlet.invision.net>
I just upgraded to per 5.004 and CGI_Lite 1.7 (from 5.003 and 1.62), and my
cgi's with file uploads seem to have become broken. Is it no longer posible
to have multipart/form-data that has a file upload and regular input fields?
I read the docs and the only (criptic) thing I could find was a reference to
multiple values for a key which I don't think affects me. I have included a
snippit below. This works with 1.62, but doesn't with 1.7:
sub grab_file {
$form = new CGI_Lite ();
$form->set_directory ("/tmp") || die "Directory doesn't exist.\n";
$form->set_platform ("UNIX");
$form->set_file_type ("handle");
%data = $form->parse_form_data ();
$filename = $data{'input_file'};
$title = $data{'title'};
$mm = $data{'mm'};
$yy = $data{'yy'};
} #grab_file
Then later I use the file handle:
if ( -T $filename) {
while (defined($line = <$filename>)) {
chomp $line;
print NEWSLTR "$line \n";
} #while
} else {
[...]
Could you let me know what I am doing wrong, or what changes I need to make
to accomodate changes in the module.
Is there anyway to uninstall 1.7 and use 1.62?
Thanks for you help,
Matt
___________________________http://www.invision.net/________________________
Matthew E. Martini, PE InVision, LLC. (516) 543-1000
Chief Technical Officer matt@invision.net (516) 864-8896 Fax
_______________________________________________________________________pgp_
------------------------------
Date: Fri, 11 Jul 1997 12:22:17 +0100
From: Paul Denman <pdenman@ims.ltd.uk>
Subject: A Quick One re; $|
Message-Id: <33C61769.5E09@ims.ltd.uk>
Hello,
I've tried reading various explanations, but none seem 'English'
enough to explain it properly;
I've 'adapted' a routine to write to a data file & it has the
following code:
$| = 1;
$exclusive_lock = 2;
$unlock_lock = 8;
$user_file = "/usr/ns-home/data/user.dat";
if (! (-r $user_file)) {
&return_Error ("503", "<H3>Error!</H3>", "Data-Read Error");
} else {
open (USER, "<" . $user_file);
flock (USER, $exclusive_lock);
etc...
What does the first line do exactly? And what would be the effect of
leaving it out?
If anyone recognises this code, or can help in any way I would
appreciate
it.
Cheers for now,
Paul Denman
---
Interactive Media Services Ltd. UK.
PS. Anyone know of any advanced Perl programming courses in the UK?
------------------------------
Date: 10 Jul 1997 15:49:31 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Are the perl modules for Win32 compiled and available?
Message-Id: <5q3ecc$eg9$1@auto.med.ohio-state.edu>
I don't have any compiler for c/c++ for WindowsNT. I found the modules
for Win32, but I don't have a compiler to compile them.
Are the modules offered in compiled format?
Mark
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: Fri, 11 Jul 1997 14:33:11 +0200
From: Tomas Pospisek <tpo@NoSpam.spin.ch>
Subject: bug in MailTools package?
Message-Id: <33C62807.397ABD5@NoSpam.spin.ch>
I use the following code:
-------------------------
require Mail::Send;
use strict;
my $msg = new Mail::Send;
$msg->subject('DB - Online Formular');
$msg->to('tpo(AT)spin.ch');
#replace (AT) by @
my $fh = $msg->open;
print $fh "bla";
$fh->close;
------------------------
now what I get is:
------------------------
Date: Fri, 11 Jul 1997 14:15:36 +0200
From: www-data <www-data@tpo.spin.ch>
To: tpo@spin.ch
~s DB - Online Formular
bla
------------------------
versions:
------------------------
# perl -v
This is perl, version 5.003_07
Copyright 1987-1996, Larry Wall
+ two suidperl security patch
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.0 source
kit.
-------------------------
MailTools-1.09
-------------------------
Any hint?
+
T
Please reply to me directly, I don't read this group very often...
--
--------------------------------------------------------------------------------
Tomas Pospisek
@ SPIN - Internet Services in Graubuenden/Switzerland
for more info have a look at "http://www.spin.ch/"
--------------------------------------------------------------------------------
------------------------------
Date: 10 Jul 1997 17:15:43 GMT
From: Torsten Naumann <Torsten.Naumann@informatik.tu-chemnitz.de>
Subject: Re: Exporting Variables...again
Message-Id: <5q35bv$pc4$1@narses.hrz.tu-chemnitz.de>
In article <33B7F022.4654@fcs.netguard.net>,
"D.Burdick" <burdick@fcs.netguard.net> writes:
> In my earlier posting I left out the line
> use Exporter ();
> after the package statement... but that is not
> what the posting was about.
I think you mustn't use the word 'my' in front of the declaration.
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw ( var );
$var = value;
--
bye Torsten
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/ Torsten Naumann +49-177-2382319 tna@informatik.tu-chemnitz.de /
/ TU Chemnitz - Fakultaet Informatik http://www.tu-chemnitz.de/~tna /
/ PGP-public-key available via finger on email-address /
/---------------------------------------------------------------------/
/ Das Schlimme an falschen Annahmen ist, /
/ da"s sie jedem Schwachkopf einleuchten. -- Leitzinger /
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: Thu, 10 Jul 1997 20:04:55 GMT
From: zatezalo.2@osu.edu (Shane)
Subject: Re: Gen. a random no. (within range)
Message-Id: <33c53ede.276998081@achilles.medctr.ohio-state.edu>
zatezalo.2@osu.edu (Shane) wrote:
>Doug Seay <seay@absyss.fr> wrote:
>
>>P.M.Wong wrote:
>>>
>>> I would like to generate a random number (whole number)
>>> But it has to fall within a certain range that i specify
>>> like, 10< n < 20
>>> Are there any statement in perl to do it ?
>>
>>&range_rand(10,20) should give you what you want. Since this is
>>untested, you should verify that it does what you want.
>>
>>
>> sub range_rand($$)
>> {
>> my ($min,$max) = @_;
>> rand($max - $min) + $min;
>> }
>>
>>- doug
>>
>>PS - Maybe you should verify that $min and $max are numeric.
>
>I ran this - it works. However, it seems to generate
>[...]
The fix: insert an srand(); at the beginning of the script (but
not in any loops).
--
zatezalo.2@osu.edu
http://www.ecaetc.ohio-state.edu/shane
------------------------------
Date: 11 Jul 1997 05:02:51 GMT
From: Zenin <zenin@best.com>
Subject: Re: Global Vars : Why would I want to use "use strict"
Message-Id: <5q4epr$oa5$2@nntp2.ba.best.com>
mashfiel <ashfield.matthew@miti.nb.ca> wrote:
>snip<
> I keep seeing the recommendation to use the statement
> use strict;
And a vary good recommendation it is too.
> From what I understand this enforces me to declare all my variables with
> my()
Kinda, among other things. It also requires that functions be
predeclared (either defined before you use them, imported from a
module, or declared using "use subs qw(subName);") and that soft
references are not allowed.
Variables do not all have to be my() declared, they just have to
be declared somehow, either locally to the function or package, or
global to the package. But they *must* be declared.
> Now, from my understanding of my(), this makes the variable statically
> local. Ie. it can only be seen in the block in which it is contained. Now
> if I do this, how would I use global variables?
use strict;
use vars qw($MY_GLOBAL %ANOTHER_GLOBAL);
$MY_GLOBAL = 'foobar';
If you're using strict, also make sure that you no longer use the
'&' char before your functions as perl4 required. If you do, you
basicly disable strict spell checking of function names.
--
-Zenin
zenin@best.com
------------------------------
Date: 11 Jul 1997 13:27:30 +0200
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: How do I lock a file in MacPerl?
Message-Id: <86n2ntx1zx.fsf@iis.ee.ethz.ch>
shaggy@redrobin.oswego.edu (Jeff Schneider) writes:
> I've modified some Perl code for a cgi that allows my students to add URLs
> to a web page for their homework. It checks for duplicate entries so that
> students can't merely copy from one another, etc. It runs off of my
> PowerMac 7100 under MacPerl v5.13r2. Here's my dilemma: A friend pointed
> out that there is the potential for a student's homework to be lost should
> the cgi be called simultaneously or nearly so by more than one student.
MacPerl can run only one script at a time and implicitly queues up CGI
requests. This is usually an unpopular fact, but in your case, it can be
construed as a feature in that it makes locking mechanisms unnecessary.
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"I'm set free to find a new illusion" -- Velvet Underground
------------------------------
Date: 10 Jul 1997 18:38:29 GMT
From: toutatis@remove.this.toutatis.net (Toutatis)
Subject: How to substract a uniq integer from a ASCI string
Message-Id: <toutatis-ya023180001007972039030001@news.euro.net>
Hi,
Could anybody advise me on how to create from a given string
an integer that somehow is (quite) unique for that character string?
I came up with the following solution myself in perl:
foreach(unpack('C*',$string)){
$code += $_;
}
It simply returns the sum of all ASCI values.
but this way, toutatis results in the same code as titatous. I need
something less easy to "crack" than this.
And my returned codes vary from string-length * 97 to string-length * 122,
where I prefer to use the *complete* integer "spectrum" to represent this
string.
Although I prefer the returned code to be an integer, a fixed width string of
say 6 characters would be fine too.
Anybody any clues on this?
--
Toutatis
------------------------------
Date: 9 Jul 1997 19:00:00 -0500
From: lamont@thrakkorzog.ece.utexas.edu (Lamont Alan Lucas)
Subject: Re: Linking old and new DBD-Oracle 32-bit object together with SGI
Message-Id: <5q18m0$kc9@thrakkorzog.ece.utexas.edu>
In article <dischner-ya02408000R3006971544370001@news.lrz-muenchen.de>,
Anton Dischner <dischner@med.uni-muenchen.de> wrote:
>Is there a solution to mix old and new 32-bit objects ?
>Any other ideas ?
There is no way under Irix to link old and new style 32 bit objects.
Also, simply removing the -n32 dosen't help, since cc defaults to -n32.
Either replace it with -32 or set SGI_ABI to -32.
Luck.
------------------------------
Date: Thu, 10 Jul 1997 23:09:31 GMT
From: zatezalo.2@osu.edu (Shane)
Subject: mixing up a list
Message-Id: <33c56b04.5845515@nntp.service.ohio-state.edu>
If I've got an arry of 100 elements, all in order, what's the easiest way to
totally mix-em up?
ie:
$s[1]="1"
...
$s[100]="100"
--
zatezalo.2@osu.edu
http://www.ecaetc.ohio-state.edu/shane
------------------------------
Date: Thu, 10 Jul 1997 19:29:52 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: mixing up a list
Message-Id: <0qu3q5.it.ln@localhost>
Shane (zatezalo.2@osu.edu) wrote:
: If I've got an arry of 100 elements, all in order, what's the easiest way to
: totally mix-em up?
: ie:
: $s[1]="1"
: ...
: $s[100]="100"
That Question is in the Perl FAQ too, proving once again that
it truly is Asked Frequently ;-)
-------------------------
=head2 How do I shuffle an array randomly?
Here's a shuffling algorithm which works its way through the list,
randomly picking another element to swap the current element with:
srand;
@new = ();
@old = 1 .. 10; # just a demo
while (@old) {
push(@new, splice(@old, rand @old, 1));
}
For large arrays, this avoids a lot of the reshuffling:
srand;
@new = ();
@old = 1 .. 10000; # just a demo
for( @old ){
my $r = rand @new+1;
push(@new,$new[$r]);
$new[$r] = $_;
}
-------------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 09 Jul 1997 08:30:04 GMT
From: bozi@connexus.apana.org.au (Michael Boswell)
Subject: Newbie Win95 Perl Q
Message-Id: <33c34b60.1029556@news.connexus.apana.org.au>
Hi, Im using HTTPD on my local computer, I load up the TCP/IP stack
and everything seems fine. I' m just starting to write perl code, but
all i'm trying to do is a simple form input, process and output. As
far as I can tell the parsing and processing is ok. The output isn't
working ? I'm writing the correct HTML format - content-type etc.. But
netscape returns with a Document contains no data error. I just don't
know what this means.
BTW im using action=get.
thanks
bozi
------------------------------
Date: Wed, 09 Jul 1997 13:24:11 +0100
From: Thomas Hoffmann <thomas.hoffmann@zentrale.adac.de>
Subject: OLE Automation fails
Message-Id: <33C382EB.4A46@zentrale.adac.de>
Hi,
I'm using Perl for Win32 Build 306 (version 5.003_07) and I have tried
to run a sample program from the doc files:
use OLE;
$excel = CreateObject OLE 'Excel.Application'
or warn "Couldn't create new instance of Excel App!!";
$excel->Workbooks->Open( 'test.xls' );
$excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)->{Value} = 'foo';
$excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)->{Value} = 'bar';
$excel->Save(); $excel->Quit();
But I always get the error message:
"Can't call method "Open" without a package or object reference at
test.pl line 4."
Excel V7.0a (german) is installed on my NT 4.0 (german) machine.
What is the problem?
Thanks in advance
Thomas
------------------------------
Date: Wed, 09 Jul 1997 13:43:04 +0200
From: Uma Shanker <uma@heidelbg.ibm.com>
Subject: Re: online tutorial
Message-Id: <33C37948.2781@heidelbg.ibm.com>
Tri Tram wrote:
>
> I've been trying to figure this out. I am trying the exercise in
> the online tutorial of perl.
>
> The sample code is:
>
> #!/usr/local/bin/perl
> #
> # Program to open the password file, read it in,
> # print it, and close it again.
>
> $file = '/etc/passwd'; # Name the file
> open(INFO, $file); # Open the file
> @lines = <INFO>; # Read it into an array
> close(INFO); # Close the file
> print @lines; # Print the array
> what it says to do is to print each line of the /etc/passwd
> file with a # in front. I should just add one line and modify another?
> I've tried putting $" = "#", but that didn't seem to help any.
> I've also tried
> print "#" . @lines, or something like that but it only printed the # in
> the first line. I can do this using a foreach, but I want to know what
> is the way the tutorial recommended? Thanks.
>
> --
> -----------------------------------------------------------------
> Tri Tram, Computer Science and Engineering at UCLA
> http://www.seas.ucla.edu/~tram
just go forward to next page of tutorial and you will guess it.
be cool. Try to find out yourself. Read about arrays their index number
and ....
bye
--
uma shanker
uma@heidelbg.ibm.com
bad mail go to /dev/null <<
------------------------------
Date: 10 Jul 1997 12:32:17 -0700
From: dizzy@soda.CSUA.Berkeley.EDU (David Zeng)
Subject: Re: Output to a file
Message-Id: <5q3dc1$t8e@soda.CSUA.Berkeley.EDU>
Hi, there,
I found out what the problem is. ^_^ I generated lots of prints for
debugging purposes in the main loop. Since the printout is too long,
I did not scroll to the end before I terminated the | more. Perl,
running as a scripting language, only processes as far as I let it
scroll down. Therefore, if I only scroll down 40 loops' contents, Perl
only processes 40 lines.
Sorry for the inconvenience.
David Zeng
------------------------------
Date: Thu, 10 Jul 1997 10:51:04 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: PERL Book
Message-Id: <33C504E8.8D51E1C@gpu.srv.ualberta.ca>
pgweb@bellatlantic.net wrote:
>
> Hi,
>
> I have been wanting to learn Perl, so that I will be able to write CGI
> scripts. Anyone have a recommendation as to what book I should use?
> Thanks in advance.
>
go with O'Reilly titles:
'Learning Perl' by Randal Schwartz
'CGI Programming on the Word Wide Web' by Shishar Gundavaram
the second edition of Learning Perl, updated for Perl5
should be out sometime this month --- the examples in the
CGI book are in perl as well.
regards
andrew
------------------------------
Date: Fri, 11 Jul 1997 00:57:17 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Perl function STDERR send to STDOUT ???
Message-Id: <ED4qnH.8Lz@bcstec.ca.boeing.com>
In article <33C4F558.54F8@nortel.ca>,
Sylvain St.Germain <sgermain@nortel.ca> wrote:
>Hi all,
>
>I need to redirect the carp STDERR message, how?
>
>I'd like to do something like:
>print LOGER &carp;
>
>Many Regards,
>Sylvain.
{ local($SIG{__WARN__}) = sub {print LOGER $_[0] };
carp "this carp written to LOGER";
}
HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.remove_it.com # remove you know what
------------------------------
Date: Tue, 08 Jul 1997 19:23:48 -0500
From: Justin Banks <justinb@cray.com>
Subject: Re: Perl is 20 times slower on Cray J90 than SGI!
Message-Id: <33C2DA14.7566@cray.com>
James J. Heck wrote:
>
> Brett,
>
> A few of us tested the same thing on our Cray J90 however it only took
> 1.28 seconds to execute. Then we ran it on a SGI R10k machine here and
> it took 1.01 seconds.
> After talking to a few ppl we believe that it has to do with the fact
> that the Cray is word addressable whereas the SGI is byte addressable.
> Thus the parsing of each line on the Cray takes more memory overhead.
>
> James
>
This is probably true (absolutely NO guarantees), but I have another
question : how many runs did you make, and which did you use for the
measurement? In other words, did you run the script several times,
notice the time difference and then measure how long it took for the SGI
to execute vs. the Cray? Sounds wierd, but it will probably make a
difference.
Also, another stupid question : what was the load? Specs? CPU, rev, OS
version (SGI)?
--
Justin Banks
Silicon Graphics Cray Research
Eagan, Minnesota
------------------------------
Date: 10 Jul 1997 17:00:42 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: Problem writing to binary file
Message-Id: <slrn5sa57u.rot.evenh@ra.pvv.ntnu.no>
In article <33c506ff.435831313@newsread.cioe.com>, Rich wrote:
>How can I prevent this from happening?
binmode(OUT);
I think that should do the trick...
Regards,
Even Holen
--
<>< Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/ :-)
------------------------------
Date: 8 Jul 1997 20:44:03 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re-Install man pages properly
Message-Id: <5pv1e4$fe0$1@lennon.postino.com>
I installed perl on a system, and during configure I answered
the suffix question wrong about man pages. I said use .3 or .1 ,
but shouldn't have put the dot. All the man pages were added with
..3 or ..1 . I would like to fix just this, but not do the complete
make over. How do I re-make and re-install just the man pages?
--
Danny SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail!
------------------------------
Date: Fri, 11 Jul 1997 00:48:15 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: regex break out of while loop broken?
Message-Id: <33C5C91F.46481F8A@gpu.srv.ualberta.ca>
Justin Banks wrote:
>
> Alright, dumb question time.
>
> Why does
>
> LINE: while(<FILE> and ! /FOOBAR/g) {
> whatever();
> }
>
> not work like
>
> LINE: while(<FILE>) {
> if(/FOOBAR/) {
> last LINE;
> }
> whatever();
> }
>
> ?
read the perlop manpage...under I/O Operators
...
If and ONLY if the input symbol is the only thing inside
the conditional of a while or for(;;) loop, the value is
automatically assigned to the variable $_
...
so:
while (defined($_=<FILE>) and !/$pattern/) {
print;
}
works like:
while (<FILE>) {
if (/$pattern/) {
last;
}
print;
}
regards
andrew
------------------------------
Date: Tue, 08 Jul 1997 22:43:55 -0700
From: Todd Hoff <tmh@possibility.com>
Subject: resolving relative paths?
Message-Id: <33C3251B.3696@possibility.com>
Is there a trick to resolving relative paths? To me the following
code should produce an absolute path:
--------------
use URI::URL;
$path= "../image/red.gif";
$base= "http://www.somewhere.com/nirvana";
$url = new URI::URL($path, $base);
$link= $url->abs->as_string ;
--------------
But it doesn't. Is there something else going on? I did
a trace and the abs method in _generic.pm is being called
but it is not making an absolute path.
thanx
------------------------------------------------------------------
tmh@possibility.com | I have no interest in any ship that
http://www.possibility.com | does not sail fast, for I plan to go
http://www.sendmecoffee.com | in harm's way. -- J.P. Jones
------------------------------
Date: Thu, 10 Jul 1997 16:22:04 GMT
From: ivan@voicenet.com (Ivan Kohler)
Subject: shift on an empty array returns ( undef ) in a list context, not an empty list?
Message-Id: <33c50a40.136336427@netnews.voicenet.com>
Hello,
Took me quite some time to track down a bug caused by my misunderstanding of
the shift command. In a scalar context, when shift'ing an empty array,
shift returns the undefined value, as expected. In a list context, however,
I was assuming (wrongly) that shift on an empty array would return an empty
list. Instead, it returns a list with one scalar value (undef).
I searched through the perl-porters' archive, and couldn't find anywhere
where a decision was made one way or the other with regards to this
behavior. My question is twofold; One, would it be desirable to modify the
behavior of shift so that it does return an empty list (and, I suppose, how
would I go about proposing such a thing), and two, can anyone think of a
less "kludgy" way to emulate my desired behavior than what I'm currently
using:
{
my($temp) = shift @array;
$temp ne undef ? $temp : ();
}
TIA for any input!
Ivan Kohler
VoiceNet Staff
ivan@voicenet.com
"I may not have the world to give to you
but maybe I have a tune or two." -JG/RH
------------------------------
Date: 10 Jul 97 22:05:45 GMT
From: maguirer@hercules.cs.uregina.ca (Robert Maguire)
Subject: Sorting List of Lists
Message-Id: <maguirer.868572345@hercules>
had a question to ask about sorting lists of lists (actually, even creating
them), but I don't need to 'cause I figured it out by looking at perllol... ;-)
thanks!
bob
------------------------------
Date: 10 Jul 1997 23:40:45 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Stripping text from a file
Message-Id: <5q3rtt$fhi$1@info.uah.edu>
Hmm.. run that last article through
% perl -pe 's/or last//g'
:-(,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 10 Jul 1997 11:35:49 -0400
From: sabol@alderaan.gsfc.nasa.gov (Edward J. Sabol)
To: Sorin Trimbitas <sorin.t@usa.net>
Subject: Re: time function for subsecond measurements
Message-Id: <h4afjuvs16.fsf@dbsrv.gsfc.nasa.gov>
Excerpts from [comp.lang.perl.misc]: (07-Jul-97) time function for subsecond measurements by Sorin Trimbitas
> Is anybody aware of a mechanism, functions or even scripts in PERL capable
> of recording subsecond intervals of time with accuracy? I know _time_ only
> deals with seconds, but I need something that is more precise.
If you are on a Unix workstation that has a modicum amount of BSD
compatibility (and even many System V OSes do), you could invoke
the BSD system function gettimeofday() via Perl's syscall() mechanism. It
will give you accuracy to the microsecond. I use something like this:
package Timer;
require "syscall.ph";
use vars qw($sec,$usec,$sec2,$usec2);
sub start
{
my($buf) = " " x 16;
syscall(&SYS_gettimeofday,$buf,0);
($sec,$usec) = unpack("LL",$buf);
}
sub stop
{
my($buf) = " " x 16;
syscall(&SYS_gettimeofday,$buf,0);
($sec2,$usec2) = unpack("LL",$buf);
my($diff) = (($sec2 - $sec) * 1000000 + ($usec2 - $usec)) / 1000000.0;
return($diff);
}
If you don't have a syscall.ph (Perl 5 doesn't seem to create one by
default), you can make one using `h2ph'.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 721
*************************************