[11282] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4882 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 12 16:07:27 1999

Date: Fri, 12 Feb 99 13:00:24 -0800
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, 12 Feb 1999     Volume: 8 Number: 4882

Today's topics:
    Re: "Learning Perl" <oly0@cncdsl.com>
    Re: \n won't work <cybir@echoweb.net>
        create list from file <t.d.bess@larc.nasa.gov>
    Re: create list from file <jeffp@crusoe.net>
    Re: create list from file <jglascoe@giss.nasa.gov>
    Re: Easy Q for a Perl Pro (Larry Rosler)
    Re: Fast Text Search (Abigail)
    Re: How to create a directory using perl on linux? jjds@para-protect.com
    Re: How to create a directory using perl on linux? (Abigail)
    Re: Interactive Programs and Perl jjds@para-protect.com
        newbie Q: subrt in a here doc <mmorgan@gladstone.uoregon.edu>
    Re: newbie Q: subrt in a here doc <jeffp@crusoe.net>
    Re: No. of lines in a file krish_v@my-dejanews.com
    Re: Non-greedy split (Mike Stok)
    Re: Perl Criticism topmind@technologist.com
    Re: perl password example <paubucho@aug.edu>
        Perl5.005_02 dynamic loading problem <reatmon@ti.com>
        Perl\Tk module for Linux <dont@send.me.nothing>
    Re: Perl\Tk module for Linux (Jason)
    Re: PFR: UTC_to_Epoch (Larry Rosler)
    Re: Problem with file creation jjds@para-protect.com
    Re: Python vs. Perl vs. tcl ? <aqumsieh@matrox.com>
        reference problem <mgcook@ic.delcoelect.com>
    Re: reference problem (Albert W. Dorrington)
        Regexp for URLs <john.wood@diamond.co.uk>
        Simple question for a complex PERLie <gyows@globeset.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 12 Feb 1999 12:25:01 PST
From: Orlando Castro <oly0@cncdsl.com>
To: Bill Garrett <bgarrett@hamilton.net>
Subject: Re: "Learning Perl"
Message-Id: <36C48FC8.10FCFA90@cncdsl.com>

Perhaps the path to perl is incorrect.
[root@nsb tools]# whereis perl
perl: /usr/bin/perl5.00404 /usr/bin/perl /usr/man/man1/perl.1



Bill Garrett wrote:

>     I got the book "Learning Perl"  and for some reason some of the
> source code doesn't work.
> I took this code exactly from the book and it doesn't work:
> #!/usr/local/bin/perl -w
> print "What is your name?";
> $name = <STDIN>;
> chomp ($name);
> print "Hello, $name!\n";
>
> What could be the problem?
> Does it only run from the shell?





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

Date: Fri, 12 Feb 1999 11:57:58 -0800
From: =?iso-8859-1?Q?Cyb=EER?= <cybir@echoweb.net>
Subject: Re: \n won't work
Message-Id: <36C487C6.322D64AC@echoweb.net>

Why would you do that?

Bill Garrett wrote:

> So how would i do it if I took out the print "Content-type: text/html\n\n";
> ?
>
> CybnR wrote:
>
> > If you are trying to print this to an html document you need a <br> tag
> > inbetween the lines, \n just makes a new line in the html source.
> > Ex.
> >
> > #!/usr/local/bin/perl
> > print "Content-type: text/html\n\n";
> > print "hello world<br>\n";
> > print "Oh look it makes new lines<br>\n";
> > print "I'm so glad!<br>\n";
> >
> > Bill Garrett wrote:
> >
> > > #!/usr/local/bin/perl
> > >  print "Content-type: text/html\n\n";
> > >  print "hello world\n";
> > >  print "how come the new line character won't work?\n";
> > >  print "I sure wish it would!\n";
> > >
> > > Could someone please tell me why \n doesn't cause this to go onto a new
> > > line.  I created this script and \n doesn't work but on some other
> > > scripts I have installed it worked.  hwat is wrong with this one??
> > > thanks,
> > > jason@wbdet.com



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

Date: Fri, 12 Feb 1999 14:48:49 -0500
From: Dale Bess <t.d.bess@larc.nasa.gov>
Subject: create list from file
Message-Id: <36C485A0.C581BA84@larc.nasa.gov>

I'm having trouble creating a list from data file of numbers that
I have opened up using open statement, i.e., I want to end up
with list like so, @file = qw(1 2 3 4 ...). I open a data file and then
use the while<> to read it in, but while works on a line at at time,
so how do I end up with a list  that I can work with within my
program, i.e, how to transform outside data file to qw list?

Dale Bess
t.d.bess@larc.nasa.gov



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

Date: Fri, 12 Feb 1999 15:35:54 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: create list from file
Message-Id: <Pine.GSO.3.96.990212153318.13007C-100000@crusoe.crusoe.net>

> I'm having trouble creating a list from data file of numbers that
> I have opened up using open statement, i.e., I want to end up
> with list like so, @file = qw(1 2 3 4 ...). I open a data file and then
> use the while<> to read it in, but while works on a line at at time,
> so how do I end up with a list  that I can work with within my
> program, i.e, how to transform outside data file to qw list?

A list is a list is list.  Using qw(...) only means "quote on whitespace".
	@list = qw(a b c);
is equivalent to:
	@list = split ' ', "a b c";

As for using a file as an array, do you need to store the file contents as
an array?  If so, a simple @array = <FILE> may do the trick.

But you may be safe just doing:

while (<FILE>){
	# do something
}

-- 
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Fri, 12 Feb 1999 15:41:46 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Dale Bess <t.d.bess@larc.nasa.gov>
Subject: Re: create list from file
Message-Id: <36C4920A.5D4798AF@giss.nasa.gov>

[courtesy cc of this posting sent to cited author; Dale]

Dale Bess wrote:
> 
> I'm having trouble creating a list from data file of numbers that
> I have opened up using open statement, i.e., I want to end up
> with list like so, @file = qw(1 2 3 4 ...). I open a data file and then
> use the while<> to read it in, but while works on a line at at time,
> so how do I end up with a list  that I can work with within my
> program, i.e, how to transform outside data file to qw list?

short answer:
@all_lines = <FH>;

longer answer:
@all_lines = ();
while (<FH>) { push @all_lines, $_ }

longest answer:
@all_lines = ();
$index = 0;
for ($line = <FH>, $index = 0; $line; $line = <FH>, ++$index)
{
    $all_lines[$index] = $line;
}


naturally, the shortest answer is the most efficient  ;)


-- 
	"I discount everything Djikstra has to say
	because he doesn't actually run his programs"

	--Rob Pike, on Djikstra's belief that bugs in
	  your program are a moral failure to prove your
	  program mathematically correct.


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

Date: Fri, 12 Feb 1999 11:16:59 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Easy Q for a Perl Pro
Message-Id: <MPG.112e1e037c26d945989a2c@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x3yu2wr4m7a.fsf@tigre.matrox.com> on Fri, 12 Feb 1999 
11:32:25 -0500, Ala Qumsieh <aqumsieh@matrox.com> says...
> 
> lr@hpl.hp.com (Larry Rosler) writes:
> 
> > > $line = lc $line;
> > > $line =~ s/(\([^\)]*\))/\U$1/g;
> >                   ^
> > Just to avoid misleading anyone, that backslash is superfluous.  
> > Parentheses are not special inside character classes.
> 
> True .. but I personally usually stick it in there or else it screws
> up my syntax highlighting.

Interesting.  Yesterday someone also justified backslashing a # for the 
very same reason.  And I myself write character classes containing 
quotes as ['aeiou'] though a casual reader might be misled to think I 
stupidly put a string in there.  I think that's probably better written 
as [''aeiou] which is equally dumb but perhaps less misleading.

I think our dumb tools are polluting our thinking processes and hence 
our code.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 12 Feb 1999 19:50:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Fast Text Search
Message-Id: <IB%w2.2763$rs2.2630404@client.news.psi.net>

Zack (zack44@altavista.net) wrote on MCMXCI September MCMXCIII in
<URL:news:36C43798.23F56182@altavista.net>:
!! 
!! They want it setup so that each PC has a local, searchable copy of the database (to reduce network traffic, it's an OOOOOLD coax network)


Unless each PC is going to do many searches a second, what significant
network traffic are we talking about?  We're dealing with exact matches
here, that's only returning a path and a description.


Please limit your lines to about 72 characters.


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Fri, 12 Feb 1999 19:45:25 GMT
From: jjds@para-protect.com
Subject: Re: How to create a directory using perl on linux?
Message-Id: <7a20cj$nhc$1@nnrp1.dejanews.com>

The command to make a directory via perl is .... as you should guess

mkdir (DIRNAME, MODE);

BTW, I suggest you make an inventment. "Programming in Perl", part of the
OReilly series, it really does answer a lot of the basics.


Jeremiah Sahlberg
Computer Security Engineer
Para-Protect Services, Inc.
jjds@para-protect.com
http://www.para-protect.com

In article <7a0k9h$gd5$1@nnrp1.dejanews.com>,
  perl_beginner@my-dejanews.com wrote:
>     What is the best way to create a directory using perl effectively/securely
> in Linux. I intended to use it as a cgi script. Thanks!
>
> -perl_beginner-
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Feb 1999 19:55:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to create a directory using perl on linux?
Message-Id: <VG%w2.2764$rs2.2630404@client.news.psi.net>

perl_beginner@my-dejanews.com (perl_beginner@my-dejanews.com) wrote on
MCMXCI September MCMXCIII in <URL:news:7a0k9h$gd5$1@nnrp1.dejanews.com>:
==     What is the best way to create a directory using perl effectively/securely
== in Linux. I intended to use it as a cgi script. Thanks!


Did you search in the documentation using the name of the shell
command to create a directory? Which part of it didn't you understand?



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Fri, 12 Feb 1999 20:22:36 GMT
From: jjds@para-protect.com
Subject: Re: Interactive Programs and Perl
Message-Id: <7a22i1$pis$1@nnrp1.dejanews.com>

I think that using Expect may be able to accomplish this task with much more
ease.  I am a huge advocate of PERL, but use the right tool for the right job,
use Expect.  Check out this link.

http://expect.nist.gov/

Good luck,

Jeremiah Sahlberg
Computer Security Engineer
Para-Protect Services, Inc.
jjds@para-protect.com
http://www.para-protect.com



In article <79thv7$pu5$1@cletus.bright.net>,
  irc_addict@hotmail.com (Thomas Brian Holdren) wrote:
> Dear Perlers,
>
> I am currently working on a user creation script in perl.  But I have run into
> a snag.  I need to run processes on a remote server from within the script,
> such as mkdir, chmod, etc.  Unfortunately, the only remote tools available to
> me are interactive programs like telnet and ftp.  Can perl interact with these
> programs?  For example, can it:
>
> pseudocode:
> --------------------
>
> system("telnet $system");
>
> (perl waits for /login: /)
> login: (perl spits out $username\n)
> (perl waits for /password: /)
> password: (perl spits out $password\n)
>
> # (perl does this)
> # (perl does that)
> ---------------------
>
> If perl can do this, the please point this befuddled newbie to the appropriate
> FAQ/Camel Chapter, or maybe you can share it with me yourself.  If it is not
> possible, perhaps you could gracefully point me towards a language that has
> this capability?
>
> Thank you for your time, dear sirs/madames.
>
> --
> tbholdren
> irc_addict@hotmail.com.nospam (remove .nospam to email me)
>
> if ($anyone_cares) {print "Just Another Perl Newbie\n"}
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Feb 1999 11:47:33 -0800
From: "M. Morgan" <mmorgan@gladstone.uoregon.edu>
Subject: newbie Q: subrt in a here doc
Message-Id: <7a206f$pbp$1@pith.uoregon.edu>

I need to have a subroutine or array in a here document.  How is this done?
I can't find it in the Perl manual.

IE

print <<HERE;
some text...
&show_msg
more text...
HERE





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

Date: Fri, 12 Feb 1999 15:31:58 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: newbie Q: subrt in a here doc
Message-Id: <Pine.GSO.3.96.990212153022.13007B-100000@crusoe.crusoe.net>

> I need to have a subroutine or array in a here document.  How is this done?
> I can't find it in the Perl manual.
> 
> print <<HERE;
> some text...
> &show_msg
> more text...
> HERE

You can use this little trick:

print "5 + 2 = @{[ 5 + 2 ]}\n";

@{[ ... ]} prints a dereferenced anonymous array.  I suggest you read
perldoc perldsc to learn more about references.

-- 
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Fri, 12 Feb 1999 20:07:56 GMT
From: krish_v@my-dejanews.com
Subject: Re: No. of lines in a file
Message-Id: <7a21mk$om2$1@nnrp1.dejanews.com>

Thank you for your explanations, Greg and Russ.
Krish

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 11 Feb 1999 09:38:27 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Non-greedy split
Message-Id: <OOkVSSdV#GA.180@news2.texas.rr.com>

In article <36C2EC97.85A751B0@cisco.com>, Tom Lynch  <tlynch@cisco.com> wrote:
>
>Greetings:
>
>	I have the following line:
>
>/vob/project/testbench/include/project_ftq.v:67:1286:   function [31:0]
>ftq_get_cmd;
>
>	I simply want to split on ":" but only 3
>	times. I use the follwoing split syntax:
>
>	@y = split(/:{1,2}?/);	
>
>	However the line still gets broken up as follows:
>
>/vob/cobalt/testbench/include/cobalt_ftq.v 67 1286    function [31 0]
>ftq_get_cmd;

Have you tried the limit argument to split, in the perfunc manual page it
says:

       split /PATTERN/,EXPR,LIMIT

       split /PATTERN/,EXPR

       split /PATTERN/

       split   Splits a string into an array of strings, and
               returns it.

       [...]

               If LIMIT is specified and is not negative, splits
               into no more than that many fields (though it may
               split into fewer).  If LIMIT is unspecified,
               trailing null fields are stripped (which potential
               users of pop() would do well to remember).  If
               LIMIT is negative, it is treated as if an
               arbitrarily large LIMIT had been specified.

In the debugger:

  DB<1> $line = 'first:second:third:firth:fifth'

  DB<2> @list = split /:/, $line, 3

  DB<3> X list
@list = (
   0  'first'
   1  'second'
   2  'third:firth:fifth'
)

You might want to read the documentation for split and use the appropriate
limit.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
                                   |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 12 Feb 1999 19:52:52 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <7a20qf$nve$1@nnrp1.dejanews.com>

In article <36c40680.5586888@news.cis.dfn.de>,
  richardc@tw2.com (Richard Clamp) wrote:
> On Fri, 12 Feb 1999 04:10:47 GMT, topmind@technologist.com wrote:
>
> >
> >Correction: If population Y tends to abuse X, then X
> >should not be used by population Y.
> >
>
> I dunno, my (Y) car wouldn't go half as well if you took it's gearbox
> (X) away, or stopped me using it.


They forced seatbelts (Calif.), child carseats, internal rollbars,
helmets (mc's), etc. on us.  The reason free-for-all does not quite work
is because the rest of society ends up paying the huge medical bills
when beltless Cowboy Joe turns himself into drewelling Vegetable Man.

Similarly, business will want to protect themselves somewhat
from syntax abuse that they and the maintenance programmer
pay for in the longer run.


>
> But then you had to know that wouldn't hold up to a second of thought,
> surely.
>
> Richard
>

-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Feb 1999 15:10:22 -0500
From: Pavel Aubuchon-Mendoza <paubucho@aug.edu>
Subject: Re: perl password example
Message-Id: <36C48AAD.A6EDDB9A@aug.edu>

I don't think that's right... the range [a-zA-Z0-9] is only 62 characters,
and the square root 4096 is 64...

"Randal L. Schwartz" wrote:

> >>>>> "Bob" == Bob Walton <walton@frontiernet.net> writes:
>
> Bob> Paul, the salt value is chosen randomly.  There are two printable
> Bob> characters in the salt, for 4096 possible salt values.
>
> I presume you mean "Two characters from the set of [a-zA-Z0-9/.]",
> but you didn't say that, and I want to make sure that everyone playing
> along at home knows what you mean too.
>
> print "Just another Unix security guy and Perl hacker,"
>
> --
> Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
> Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
> Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
> Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
> Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me

--
Pavel Aubuchon-Mendoza
Network Specalist I
Augusta State University
(706)737-1484
pgp: finger csvpra@news.aug.edu




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

Date: Fri, 12 Feb 1999 13:32:42 -0600
From: Ryan Eatmon <reatmon@ti.com>
Subject: Perl5.005_02 dynamic loading problem
Message-Id: <36C481DA.F13AD883@ti.com>


I'm trying to compile 5.005_02 for Solaris 2.5.1.  It compiles, but then
I try to compile Tk 800.012 and then test it and it tells me that perl
can't load the Tk.so.  It gives the error:

Can't load
'/users/reatmon/perl/Tk800.012/blib/lib/sun4-solaris/auto/Tk/Tk.so' for
module Tk: ld.so.1: /apps/unsupported/perl5.005_02/bin/perl: fatal:
relocation error: symbol not found: TkpCmapStressed: referenced in
/users/reatmon/perl/Tk800.012/blib/lib/sun4-solaris/auto/Tk/Tk.so at
/apps/unsupported/perl5.005_02/lib/5.00502/sun4-solaris/DynaLoader.pm
line 168.

I looked in the install notes under the make section for Perl and saw
the part about the dynamic loading in perl and what switches to set for
it, but even after I did all of the things that it says to try.  I've
tried with cc, gcc, gcc and the gnu ld/as 2.9/2.9.1.  I've tried
standing on my head, as well as trying this blind folded.

Has anyone else had any problems compiling perl5.005_02 on Solaris
2.5.1?  Or is the error that I'm seeing not a problem with perl. but
rather a problem with the compile of Tk 800.012?  At this point I'm lost
for ideas.  Thanks for any input.


-- 

Ryan Eatmon                reatmon@ti.com
-----------------------------------------
Mixed Signal Product Development EDA Team


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

Date: Fri, 12 Feb 1999 11:00:57 -0800
From: KC <dont@send.me.nothing>
Subject: Perl\Tk module for Linux
Message-Id: <36C47A69.F9A7B3A3@send.me.nothing>

Anybody know where I can get the Perl\Tk module/package for Linux. It is
probably the same as the one for UNIX...I don't know. Anyway, I found
this package and downloaded it once, but can't now to save my life!
-- 
-----

KC


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

Date: 12 Feb 1999 19:56:37 GMT
From: robobob@blech.mindwell.com (Jason)
Subject: Re: Perl\Tk module for Linux
Message-Id: <slrn7c91rl.8u2.robobob@blech.mindwell.com>

On Fri, 12 Feb 1999 11:00:57 -0800, KC <dont@send.me.nothing> wrote:
>Anybody know where I can get the Perl\Tk module/package for Linux. It is
>probably the same as the one for UNIX...I don't know. Anyway, I found
>this package and downloaded it once, but can't now to save my life!
>-- 

http://www.perl.com/CPAN/modules/by-module/Tk/


-- 
        Jason Kohles -- jason@mediabang.com
        http://www.mediabang.com/

          "This is as bad as it can get, but don't bet on it."


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

Date: Fri, 12 Feb 1999 11:37:21 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PFR: UTC_to_Epoch
Message-Id: <MPG.112e22cdc0ca2049989a2d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <xTZw2.2752$rs2.2589589@client.news.psi.net> on Fri, 12 Feb 
1999 17:52:29 GMT, Abigail <abigail@fnx.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MCMXCI September MCMXCIII in
> <URL:news:MPG.112d27d35a79a401989a24@nntp.hpl.hp.com>:
 ...
> []     # Adapted from Astronomical Computing, Sky & Telescope, May, 1984.
> []     24 * 60 * 60 * (367 * $year - 678972 - 40587 + int(275 * $mon / 9) +
> []         $day - int((int(int($year + ($mon < 9 ? -1 : 1) *
> []         int(abs($mon - 9) / 7)) / 100) + 1) * 3 / 4) -
> []         int(7 * (int(($mon + 9) / 12) + $year) / 4)) +
> []         60 * 60 * $hour + 60 * $min + $sec
> [] }
> 
> 
> Perhaps you want to 'use integer;', which would avoid the calls to
> int() and should speed up things as well.

You may well be right.  As I said in one posting, the original was 
Fortran that I transliterated to Perl.  I was concerned that there might 
be intermediate quotients that were then multiplied by something, so the 
fractional part might be significant.  I will look over each step more 
carefully and follow your suggestion if it is correct.

On a larger note, isn't it true that instruction dispatch in the perl 
code overwhelms the cost of individual arithmetic instructions, 
especially with modern hardware where integer division time and 
floating-point division time are comparable and very cheap?  So the 
whole improvement might not be noticeable (except in the clarity of the 
code, which is a Good Thing in itself).

>                                            As for allowing up to 2099,
> Perl isn't 64bit aware, not even on 64bit platforms, is it? At least,
> it doesn't seem to be on mine.

If one assumes that the smallest time is 0 at the Unix Epoch, then a 32-
bit *unsigned* integer carries one well into 2106.  As I have said 
repeatedly, there is no Y2038 problem in representing epoch times, only 
in representing epoch *intervals*.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 12 Feb 1999 19:26:36 GMT
From: jjds@para-protect.com
Subject: Re: Problem with file creation
Message-Id: <7a1v90$mh6$1@nnrp1.dejanews.com>

I have two suggestions

1) write the full path of the file that you wish to create. ie.

Instead of
open (RECORD,">$filen".".txt")||die"Cant create file";
Try
open (RECORD,">/usr/local/{..whereever.}/$filen.txt")||die"Cant create file";
without the {...}

2) make sure that the userid that the web server runs as (usually nobody) has
permission to write to the directory that you are trying to create.

Good luck,

Jeremiah Sahlberg
Computer Security Engineer
Para-Protect Services, Inc.
jjds@para-protect.com
http://www.para-protect.com


In article <Pine.OSF.4.00.9902120040340.16165-100000@yoyo.cc.monash.edu.au>,
  Patrick Fong <patfong@yoyo.cc.monash.edu.au> wrote:
>
> As you can see with my subject .. I have trouble creating a file using
> HTML.
>
> here is my tragic situation - I am doing form processing and I wish to
> create a file with respect to the person's name and then input data into
> it. When I go onto the next page of my form and press Submit... An error
> occurs saying that the file does not exist. So I think that it is probably
> that the file was not created in the first place.
>
> here is an abstract of my code
>
> $filen = $FORM{filename};
> open (RECORD,">$filen".".txt")||die"Cant create file";
>
> and for sequential pages
> open (RECORD,">>$filen".".txt")||die"Cant create file";
>
> Something tells me that I cannot do this... is it possible? Or maybe I
> should construct a .pl file that stores the data in fields.
>
> Or if anyone else have any ideas... would really appreciate if you could
> help me.
>
> P.
>
>
********************************************************************************
*****
> Three rules I live by
>
> 1) Everyone has eaten Macdonalds.
> 2) Everyone has seen Neighbours at least once.
> 3) Everyone has peed in the shower.
>
> I am 110% Malaysian with 2% Australian.
>
> So when I ask you, "So how?" I would expect you to answer, "Like that lor".
>
> Email:
>
> pfon2@student.monash.edu.au
> lielar@hotmail.com
> lesdabetter@geocities.com.au
> patfong@yoyo.cc.monash.edu.au
> patfong@eisa.net.au
>
********************************************************************************
*****
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Feb 1999 18:53:56 GMT
From: @l@ <aqumsieh@matrox.com>
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <7a1tbv$ko5$1@nnrp1.dejanews.com>

In article <wkaeym6pxl.fsf@ifi.uio.no>,
  Lars Marius Garshol <larsga@ifi.uio.no> wrote:

> I agree with that. What bothered me and made me write the article was
> mainly that a lot of people seemed to choose Perl without even knowing
> Python, tcl, Ruby, REXX or anything else existed at all.

Come on .. you can't hate Perl just because it's popular!

> I basically wanted to scream out and see if something happened. And it
> did: I got the frustration out of my system. :)

You also got me into reading more Python :) So far, I like it .. I think
there are a lot of similarities with Perl. Treating everything as an object
will be tricky at the beginning (for me at least), but I am planning to get
over that. I wonder how I will feel about it as I read more. I have heard
some people say that choosing to write their next program in Perl or Python
is basically determined by a coin toss. That scares me :)

> I agree that these are weak points in the syntax. However, I can't
> really think of any better alternatives myself, and also, they are in
> parts of the language I rarely need. So thankfully the damage is

Hmmm.. you rarely need print() statements in your scripts? Most of my scripts
generate some form of report after some extensive analysis. I don't think I
can live without print()! (or can I?)

> limited. (And, yes, it reminds me too of Basic, although the varieties
> I've used used ';' instead of ','.)

Yep .. that's it. It has been so long :)

> The trouble with references in Perl for me is that I generally
> organize my programs around my data structure and I think in terms of
> the data structure. So languages that make it hard for me to build the
> data structure do not get a lot of points. :)

I guess you just have to learn how to think in the proper way when dealing
with references. Treating everything as objects in Python also needs some
getting used to.

> * Lars Marius Garshol
> |
> | Do they automatically get the signatures of subroutines and methods
> | right in the generated documentation?
>
> * aqumsieh@matrox.com
> |
> | If you include the proper pod syntax .. yes.
>
> In other words: no. :)

:-)

> With javadoc and pythondoc the signature description is generated
> automatically for you. With pod it seems you need to write it (and
> much worse, keep it in sync with your code) yourself. It's not the end
> of the world, but it is a disadvantage.

Agreed. But I really like the man-style pod syntax, although it takes some
time to write.

> | A more important issue is efficiency (IMHO). I will have to wait
> | until I know enough Python to make a comparison there.
>
> I think you'll find that Python can be both startlingly effective and
> also exasperatingly slow. Usually, speeding it up when it is very slow
> is relatively easy.

I guess I'll just have to wait and see.

--Ala
$monger->{montreal}->[0];

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 12 Feb 1999 13:50:01 -0800
From: "Micah G. Cook" <mgcook@ic.delcoelect.com>
Subject: reference problem
Message-Id: <36C4A209.3732@ic.delcoelect.com>

Please take alook at this:

@node_list = `cat node_list` ;

foreach $line (@node_list) {
@line = split(/\s+/, $line) ;

if ($line[0] !~ /^#/) {
	$node = $line[0] ;
        @name = $line[0] ;
        $status = "active" ;
        push (@name,  $status) ;
	$$node{$node) = @name ;
}
}

$test = "koicds02" ;      #this is my node name
print "$$test{$test}\n" ;

ok, this works, but is prints out   2    instead of    koicds02 active	 

this is a reference problem i want it to print out   koicds02 active
instead of the number of elements in the array.


please, i donot need a lecture on programming style, this is a quick
test, it is not my code, i donot want to change my programming style
to yours.    this simply prints out   2
and i want it to print out     koicds02 active


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

Date: 12 Feb 1999 14:23:23 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
To: "Micah G. Cook" <mgcook@ic.delcoelect.com>
Subject: Re: reference problem
Message-Id: <7a1v3b$1ri@ws051eng.delcoelect.com>


In article <36C4A209.3732@ic.delcoelect.com>, "Micah G. Cook" <mgcook@ic.delcoelect.com> writes:
:> Please take alook at this:
:> 
:> @node_list = `cat node_list` ;
:> 
:> foreach $line (@node_list) {
:> @line = split(/\s+/, $line) ;
:> 
:> if ($line[0] !~ /^#/) {
:> 	$node = $line[0] ;
:>         @name = $line[0] ;
:>         $status = "active" ;
:>         push (@name,  $status) ;
:> 	$$node{$node) = @name ;
:> }
:> }
:> 
:> $test = "koicds02" ;      #this is my node name
:> print "$$test{$test}\n" ;
:> 
:> ok, this works, but is prints out   2    instead of    koicds02 active	 
:> 
:> this is a reference problem i want it to print out   koicds02 active
:> instead of the number of elements in the array.
:> 
:> 
:> please, i donot need a lecture on programming style, this is a quick
:> test, it is not my code, i donot want to change my programming style
:> to yours.    this simply prints out   2
:> and i want it to print out     koicds02 active


The reason your print statement is outputing a '2' is because
that is what you are storing in the hash.

The line:

	$$node{$node} = @name;

evaluates @name as a scalar, not an array.  So you aren't
storing the array into the hash, but the size of the array.
Your array contains two elements, hence the value of 2 you 
are seeing in the print statement.

In order to see the output you are expecting, you would need
to rewrite the line to store the actual array:

	$$node{$node} = [ @name ];

The rest of the code should work correctly.

This information is covered in chapter 4 of 
'Programming Perl, 2nd Edition'

- Al

-- 
Al Dorrington                                      
FIRMS & Web Admin, Oracle DBA                     Phone: 765-451-9655 
IC-DELCO CIM, Delphi Delco Electronics Systems    Fax:   765-451-8230 


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

Date: Fri, 12 Feb 1999 19:48:01 -0000
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Regexp for URLs
Message-Id: <7a20d6$aje$1@nclient3-gui.server.ntli.net>

This regexp should find any valid URLs in $message that are not already
hyperlinks and make them such.
It does work, but only for the first URL in the message. I've tried while
loops and such, but I can't find a satisfactory answer.
And help appreciated...

if ($message =~
m&http://(?:[a-z\d][a-z\d]+?(?:\-|\.)?)+\.[a-z]{2,3}(?:/(?:[\w\-/~.]+(?:\w|/
))?)?&gi and $` !~ /(<a .*?>|href=")$/) {
    substr($message,length($`),length($&)) = qq&<a href="$&" title="Auto
URL">$&</a>&;
}


-Paul.




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

Date: Fri, 12 Feb 1999 13:59:42 -0600
From: "Gregg Yows" <gyows@globeset.com>
Subject: Simple question for a complex PERLie
Message-Id: <7a219s$n8c$1@onion.globeset.com>

OK, so it's been awhile since I was a PERLie. But, I'm back in the
game-feelin' the pain.

I need to parse and HTML file that ain't too spiffy.

Need to replace:

<tr>
                <td>I.F.49</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>Use SSL channel from e-link POS:</td>
                <td>&nbsp;</td> <--THIS HERE
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
 </tr>

with

<tr>
                <td>I.F.49</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>Use SSL channel from e-link POS:</td>
                <td><img src=u.jpg></td> <--WITH THIS HERE
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
 </tr>

This is a test plan  doc that's huge.  I didn't write and I'll be damned if
I'm gonna cutnpaste them icon links.

Here is what I have. I can't get anything to write to my logfile. The
program just hangs.
syntax OK

$newstring="<img src=u.jpg>";
while(<>){
  open (TESTPLAN, "testplantest.htm") || die "Can't open
testplantest.htm\n";
  if ($a eq "/<tr>\w+<\\tr><tr>&nbsp; <\\tr>/"){
  s/\&nbsp/$newstring/g; # I know this line is probably hosed
 }
}

I can't do a simple string switch because I only want to switch the last
part of the string.
Help me Obi-wan Kenobi-you're my only hope.





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 4882
**************************************

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