[12740] in Perl-Users-Digest
Perl-Users Digest, Issue: 150 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 15 04:07:19 1999
Date: Thu, 15 Jul 1999 01:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 15 Jul 1999 Volume: 9 Number: 150
Today's topics:
$!: Translation 11 --> 'EAGAIN' ? <nospam.newton@gmx.net>
Accessing DBM file <pylim@ecr.mu.oz.au>
Re: Anybody know how to to this? (Larry Rosler)
Re: bug in vars.pm? (Ronald J Kimball)
Re: Como ler un directorio... (Ronald J Kimball)
Re: crypt returns different values since ISP upgrade. (Ronald J Kimball)
deep recursion <wendigo@deathstar.jabberwock.org>
Re: difference between my and local? (Iain Chalmers)
Re: Every morning at 6.00 am on a NT-box... (Andreas Fehr)
Re: from a pipe (Ronald J Kimball)
Re: FTP Question (Andreas Fehr)
Re: Generating Passwords (Ronald J Kimball)
Re: Generating Passwords (Larry Rosler)
Re: getting modify times with perl&unix (Larry Rosler)
Re: help with perl (Jim Britain)
Re: HELP: FileHandle usage fails (Ronald J Kimball)
Re: knowing it's own name? (Andreas Fehr)
Re: knowing it's own name? (Andreas Fehr)
matching a real \ in Japanese (multibyte characters) <varin@vibu.com>
Re: matching a real \ in Japanese (multibyte characters <uri@sysarch.com>
Re: Not able to write to file (Larry Rosler)
Re: Old database is erased when I add new information (Neko)
Re: Opposite of chr() (Ronald J Kimball)
Re: Perl on NT - SIG handlers (Larry Rosler)
Re: regex help needed (Ronald J Kimball)
Re: Test if a File Exists? (Ronald J Kimball)
Re: time funciton or module (Iain Chalmers)
Re: time funciton or module (Larry Rosler)
Re: Tom Christiansen is a perlscript himself... (Ronald J Kimball)
Unique but Simple Combinations of functions tony_d_1@my-deja.com
Re: Unique but Simple Combinations of functions (Larry Rosler)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 15 Jul 1999 09:39:59 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: $!: Translation 11 --> 'EAGAIN' ?
Message-Id: <378D904F.509CFB8A@gmx.net>
Hi there,
I would like to print the value of errno ($!) as 'Exxxx'. Unfortunately,
I can't seem to find out how.
What I'm doing is doing a non-blocking recv using the O_NONBLOCK fcntl
flag with recv(). When no data is available, recv returns undef and sets
$! to EAGAIN. I would like to print out the mnemonic corresponding to $!
on each attempt. However, using $! in a numeric context gives me 11 and
using it in string context gives me 'Resource temporarily unavailable'.
Is there a way to get the string 'EAGAIN' out of $! ?
Looking through the docs for POSIX.pm told me that I can catch EAGAIN
with if($! == EAGAIN) since POSIX exports EAGAIN if you give it the
argument :errno_h in the use line. Errno.pm tells me I could write if(!
$!{EAGAIN}). However, neither of these ways gets me any closer to my
goal (the string 'EAGAIN'). h2ph on errno.h doesn't look promising,
either.
Any help is appreciated.
Cheers,
Philip
------------------------------
Date: Thu, 15 Jul 1999 07:09:14 +0000
From: Paul Lim <pylim@ecr.mu.oz.au>
Subject: Accessing DBM file
Message-Id: <378D891A.5686E8A4@ecr.mu.oz.au>
I hope someone can help me with this issue.
I have a Perl script that runs a hack of Selena Sol's Calendar. I want
to now link the password authentication to the user database on my web
server (Apache). However I don't seem to be able to open the password
file with the following code: (this was to test whether or not I could
read the data)
use DB_File;
dbmopen (%DBM, "/www/vwliv/home/userdb/passwd", 0666) || die
"Cannot open file passwd file: $!\n";
while (($key, $value) = each %DBM) {
print "key=$key, value=$value\n";
}
dbmclose %DBM;
All this does when I run it is create a file "passwd" in the directory.
The passwd DB is an NDBM (i assume) database created using the
"user_manage.cgi" script, and is contained in the usual two files:
"passwd.dir" and "passwd.pag".
Thanks in advance,
Paul
------------------------------
Date: Wed, 14 Jul 1999 22:44:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Anybody know how to to this?
Message-Id: <MPG.11f71531302268ac989cd0@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7mjego$2a07@news.cyber.net.pk> on Wed, 14 Jul 1999 20:43:21
+0500, Faisal Nasim <swiftkid@bigfoot.com> says...
...
> If thats a scalar:
> $mystring =~ s/\n/<br>\n/g;
>
> If thats an array:
> print join "\n" , @array;
Surely you meant to join with '<BR>' or "<BR>\n".
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 15 Jul 1999 01:44:30 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: bug in vars.pm?
Message-Id: <1duyj8a.1pkgirvzeh8dwN@p82.tc2.metro.ma.tiac.com>
John M. Dlugosz <john@dlugosz.com> wrote:
> Also, what is the benifit of using tr/// with an empty replacement string
> (which does nothing but returns a count of chars matching the source string)
> instead of the more common s// ? Is this a technique we should all be
> using?
Because tr/// is much more efficient than s/// for counting characters,
of course. tr/// is more efficient in any situation involving simple
translation of characters.
--
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
perl -s -e'print+sort+grep{tr/ \n//}keys%main::
' -- -is -' Just' -' another ' -'Perl ' -'hacker
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]
------------------------------
Date: Thu, 15 Jul 1999 01:44:33 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Como ler un directorio...
Message-Id: <1duyjmn.1af956141itj7N@p82.tc2.metro.ma.tiac.com>
Rodrigo <rcortes@alumnos.utfsm.cl> wrote:
> Se puede hacer en perl que un script lea un directorio y guarde en un
> arreglo los nombres de todos los archivos que existen en dicho
> directorio??
> De ser asi... como se puede hacer???
Si, con opendir() y readdir().
opendir(DIR, $directorio)
or die "No se puede abrir el directorio $directorio: $!\n";
@archivos = readdir(DIR);
Pero... Si "archivo" dice "el que no es un directorio", entonces:
opendir(DIR, $directorio)
or die "No se puede abrir el directorio $directorio: $!\n";
@archivos = grep { -f "$directorio/$_" } readdir(DIR);
> Por favor envien sus respuestas a roco3d@softhome.net
>
> Muchas gracias...
Espero que eso ayuda.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 01:44:35 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: crypt returns different values since ISP upgrade.
Message-Id: <1duyk76.1c6l1q8mha5udN@p82.tc2.metro.ma.tiac.com>
Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu> wrote:
> if (crypt($user, substr($passwd, 0, 2)) eq $passwd) {
crypt() truncates the salt to two characters for you, so doing the
substr() is redundant.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 15 Jul 1999 01:29:31 -0400
From: Mark Rogaski <wendigo@deathstar.jabberwock.org>
Subject: deep recursion
Message-Id: <378d71bb@news.eclipse.net>
How deep does recursion have to go before Perl carps about deep recursion?
Is there a hard limit, and can this limit be manipulated?
Mark
--
Mark Rogaski | "I want to see movies of my dreams."
wendigo@pobox.com | -- Built To Spill, "Car"
http://www.pobox.com/~wendigo | "Computers save time like kudzu
__END__ | prevents soil erosion." - Al Castanoli
------------------------------
Date: Thu, 15 Jul 1999 16:07:06 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: difference between my and local?
Message-Id: <bigiain-1507991607060001@bigman.mighty.aust.com>
In article <378BF1DF.9AFA4FC@post.utfors.se>, @no.no wrote:
> ..perldoc tells the same about those functions ..
> .. what's differs chop from chomp?
no it doesn't, read it again.
big
--
"Beginning at about 72 seconds, a series of events occurred
extremely rapidly that terminated the flight."
<http://www.ksc.nasa.gov/shuttle/missions/51-l/mission-51-l.html>
------------------------------
Date: Thu, 15 Jul 1999 06:05:23 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: Every morning at 6.00 am on a NT-box...
Message-Id: <378d79dd.2637602@news.uniplus.ch>
On Wed, 14 Jul 1999 13:33:19 GMT, hschomae@rz-online.de (Henri
Schomäcker) wrote:
>My problem is how to do this job best on the NT-I-Net Server.
>
>I thought of starting a script which mails the actual textfile as
>attachment, and renames it afterwoods.
>
>But how to start the script the best way?
I have something similar for my Apache logs. I use the at command.
Try 'at /?'
Andreas
------------------------------
Date: Thu, 15 Jul 1999 01:44:36 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: from a pipe
Message-Id: <1duykou.516u5txzfvpxN@p82.tc2.metro.ma.tiac.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
> Tad McClellan wrote:
>
> >: I don't mean to sound stupid again, but what is wrong
> >: about the
> >: if ($_=~$pat){
> >
> > It does not follow the syntax for a pattern match.
>
> And yet, it works. Weird, huh?
perlop:
Binding Operators
[...]
If the right argument is an expression rather than a search pattern,
substitution, or transliteration, it is interpreted as a search
pattern at run time.
[...]
Programming Perl, 2nd Ed. adds:
That is, $_ =~ $pat is equivalent to $_ =~ /$pat/.
So, what was your question? ;)
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 05:55:46 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: FTP Question
Message-Id: <378d76dd.1869287@news.uniplus.ch>
On 14 Jul 1999 02:11:55 -0500, abigail@delanet.com (Abigail) wrote:
>mike (mamedeo@yahoo.com) wrote on MMCXLIII September MCMXCIII in
><URL:news:378BE160.8386F129@yahoo.com>:
>
>Here's some starters code:
>
>#!/opt/perl/bin/perl -w
^^^^^^^^^
For starters: this might be different on other systems...
If you run a Win(DOS) box, add a '.exe' to the last perl
and a drive letter just after the '!'.
>
>use strict;
>use Net::FTP;
>
># Fill in site specific details below.
>
>__END__
>
Andreas
------------------------------
Date: Thu, 15 Jul 1999 01:44:38 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Generating Passwords
Message-Id: <1duykv9.w4h9cdv5ggldN@p82.tc2.metro.ma.tiac.com>
Faisal Nasim <swiftkid@bigfoot.com> wrote:
> : {
> : ( $_ = chr rand 123 and /[A-Z0-9]/i && $pass !~ $_ and $pass .= $_ ) ||
> : redo
> : for 1 .. 8
> : }
> :
> local $_ = chr rand 123 and ( /[A-Z0-9]/i && $pass !~ $_ and $pass .= $_ )
> while length $pass < 8;
If you don't want characters aside from A-Z, a-z, and 0-9, whyever do
you waste time generating them??
@chars = ('A' .. 'Z', 'a' .. 'z', 0 .. 9);
@tmp = @chars;
$pass = '';
while (length $pass < 8) {
$pass .= splice @tmp, rand @tmp, 1;
}
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 14 Jul 1999 22:35:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Generating Passwords
Message-Id: <MPG.11f712f27c97f575989ccf@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7mjsqf$2a010@news.cyber.net.pk> on Thu, 15 Jul 1999 00:46:45
+0500, Faisal Nasim <swiftkid@bigfoot.com> says...
> : {
> : ( $_ = chr rand 123 and /[A-Z0-9]/i && $pass !~ $_ and $pass .= $_ ) ||
> : redo
> : for 1 .. 8
> : }
> :
>
> I came up with:
>
> local $_ = chr rand 123 and ( /[A-Z0-9]/i && $pass !~ $_ and $pass .= $_ )
> while length $pass < 8;
What does '$pass !~ $_' mean? '$pass !~ /$_/' or 'index($pass, $_) < 0'
(which is much faster than compiling a regex for each character).
> after posting.
>
> any better ideas?
my @a = ('A' .. 'Z', 'a' .. 'z', '0' .. '9');
my $pass = join "", map splice(@a, rand @a, 1), 1 .. 8;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 14 Jul 1999 23:08:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting modify times with perl&unix
Message-Id: <MPG.11f71ac938af5fbd989cd2@nntp.hpl.hp.com>
In article <slrn7opq3a.4jl.*@dragons.duesouth.net> on Wed, 14 Jul 1999
20:08:43 GMT, Matthew Bafford <*@dragons.duesouth.net> says...
...
> $mtime = qx!remsh $hostname "perl -e 'print modtime'"!;
I don't understand this. Are you not instructing the remote perl to
print the contents of (undefined) $_ to an (unopened) filehandle
'modtime'?
Please clarify what this actually does.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 15 Jul 1999 07:50:55 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: help with perl
Message-Id: <378e8e82.9491619@news>
>GreenDay1a (greenday1a@aol.com) wrote:
>
>: I downloaded the stable_tar.gz from www.perl.com and I don't know what to do
Microsoft in it's infinite wisdom has decided that files only contain
one dot character, so like a spelling corrector, the change the
incorrect(according to them) character to an underline. They will
also adjust the case of characters -- for instance if the name
contains spaces, quite naturally, each word in that file name would
begin with a capital letter..
I understand that now they have encorporated the superior CP/M "file
typing by last 3 name characters", They will also start selling a
spell checker for filenames -- to ensure that filenames are spelled in
concordia microsoft.
Now, a workaround for Winzip, is simply to replace the _ character
with a dot character, and Winzip will now recognize that after it has
gotten rid of that gz stuff, it has another kind of file that it knows
something about -- a tar file in the temp directory, and will ask if
you want to expand and display the tar file..
Some day, microsoft may rediscover the PC-DOS 3.2 internal signature
method of file recognition, which they incorporated in MS-DOS 3.3,
which UNIX has incanted for years as "magic".
In other words, replace the underline in the filename, with a dot, and
Winzip (and other extractors which depend upon the name) will be able
to recognize as the proper file type.
There's another method, too, change the name to stable.tgz and Winzip
will also handle it correctly.
------------------------------
Date: Thu, 15 Jul 1999 01:44:39 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: HELP: FileHandle usage fails
Message-Id: <1duyldo.wnnzsdnvdiuvN@p82.tc2.metro.ma.tiac.com>
tbrannon <brannon@quake.usc.edu> wrote:
> When running the line:
>
> print <$fh[$i]>;
>
> I get the error:
>
> sh: -c: line 1: syntax error near unexpected token `IO::File=GLOB(0'
> sh: -c: line 1: `echo IO::File=GLOB(0x824b88c)|tr -s ' '
> '\012\012\012\012''
RTFM.
perlop:
If the string inside the angle brackets is a reference to a scalar
variable (e.g., <$foo>), then that variable contains the name of the
filehandle to input from, or its typeglob, or a reference to the
same. For example:
$fh = \*STDIN;
$line = <$fh>;
If what's within the angle brackets is neither a filehandle nor a
simple scalar variable containing a filehandle name, typeglob, or
typeglob reference, it is interpreted as a filename pattern to be
globbed, and either a list of filenames or the next filename in the
list is returned, depending on context. This distinction is
determined on syntactic grounds alone. That means <$x> is always a
readline from an indirect handle, but <$hash{key}> is always a glob.
That's because $x is a simple scalar variable, but $hash{key} is
not--it's a hash element.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 05:32:30 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: knowing it's own name?
Message-Id: <378d726c.732563@news.uniplus.ch>
On Wed, 14 Jul 1999 14:47:52 GMT, KamiBot@rotfl.com (Vice Admiral
Acker) wrote:
>I kinda guess you sorta mean:
>
>$script = $ENV{'SCRIPT_FILENAME'};
>print "$script\n";
>
>This will print the full pathname of the file you're using, if I'm correct.
>
And what, if there is no WEB server to fill this variable?
BTW, ich glaub noed, dass d Kommunikation eifacher isch,
waenn ali i ihrem eigene Dialaekt schriibed.
Andreas
------------------------------
Date: Thu, 15 Jul 1999 05:38:17 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: knowing it's own name?
Message-Id: <378d737a.1002040@news.uniplus.ch>
On Wed, 14 Jul 1999 08:18:23 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:
>In article <378ca310.5002338@news3.inxpress.net> on Wed, 14 Jul 1999
>14:47:52 GMT, Vice Admiral Acker <KamiBot@rotfl.com> says...
>> I kinda guess you sorta mean:
>>
>> $script = $ENV{'SCRIPT_FILENAME'};
>> print "$script\n";
>
>I kinda guess you sorta mean:
>
> $script = $ENV{SCRIPT_NAME};
>
>> This will print the full pathname of the file you're using, if I'm correct.
Probably depending on the server. In my Apache documentation
both are correct _FILENAME for the full path, _NAME for the
relative path.
Andreas
------------------------------
Date: Thu, 15 Jul 1999 16:15:37 +0900
From: Anatole Varin <varin@vibu.com>
Subject: matching a real \ in Japanese (multibyte characters)
Message-Id: <378D8A93.FAD0DF80@vibu.com>
I'm having trouble adapting a Perl script to support Japanse shift-jis
characters. The problem I'm having is that part of my script has regexs
such as these:
s/\\/\/g;
s/\(/(/g;
s/\)/)/g;
s/\[/[/g;
s/\]/]/g;
The problem is these characters are often the second byte of a double
byte japanese character, so Perl ends up slicing of a byte that I would
prefer it didn't.
I've done a bit of reasearch and I've found out that the first byte of
any two-byte shift-jis character falls in the range of:
0x81-0x9F or 0xE0-0xEF
the second byte falls in the range of:
0x40-0x7E or 0x80-0xFC (where \()[] and other friends seem to hang out)
Any ideas how I could make a regex that would only match \ (for example)
if were not part of the two-byte sequence above?
------------------------------
Date: 15 Jul 1999 03:25:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: matching a real \ in Japanese (multibyte characters)
Message-Id: <x7r9maml14.fsf@home.sysarch.com>
>>>>> "AV" == Anatole Varin <varin@vibu.com> writes:
AV> I'm having trouble adapting a Perl script to support Japanse shift-jis
AV> characters. The problem I'm having is that part of my script has regexs
AV> such as these:
AV> s/\\/\/g;
AV> The problem is these characters are often the second byte of a double
AV> byte japanese character, so Perl ends up slicing of a byte that I would
AV> prefer it didn't.
AV> Any ideas how I could make a regex that would only match \ (for example)
AV> if were not part of the two-byte sequence above?
buy and read mastering regular expressions. it has the answers you
seek. its author lived in japan for some years and knows that topic
well.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 14 Jul 1999 22:06:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Not able to write to file
Message-Id: <MPG.11f70c44d7317b30989cce@nntp.hpl.hp.com>
In article <7mj0q4$te8$1@nnrp1.deja.com> on Wed, 14 Jul 1999 21:52:09
GMT, LV Josh <lv_josh@my-deja.com> says...
> This worked! thanks!!! now maybe you can clear something else up for
> me...
It didn't work, though, did it? You wrote to the file, but didn't get
what you wanted.
> here is my script: (there is a file in the same directory named test
> that consist of one line that reads "josh was here")
> ---
> #!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
> open(TEST, "+<test");
^ or die "Couldn't open 'test'. $!\n"
> while (<TEST>) {
> tr/josh/dave;
> print TEST;
> }
> close(TEST);
I guess you didn't understand the FAQ you were pointed to by two of us,
which suggests writing to a temp file, then renaming it when successful.
The approach you have chosen risks corrupting your data.
> my desired effect is to replace the original line so that it now
> reads "dave was here" but instead it just adds it as a new line. this
> is the the result of "test" after the script is run:
>
> josh was here
> dave was here
You cannot in general read and write simultaneously. You can
accumulate into an array the data you want to write; seek back
to the beginning of the file (`perldoc -f seek`), truncate the
file length to 0 (in case what you write is shorter than the
original; `perldoc -f truncate`), then finally print the array
to the file and close it.
> thanks for your patience, but know that i am at least looking through
> the llama and camel book before asking over usenet.
Good. Look through the FAQs too.
> In article <378CA3BE.3136080F@NO-SPAMamericasm01.nt.com>,
> Marshall Culpepper <marshalc@NO-SPAMamericasm01.nt.com> wrote:
> > you probably forgot to write the saved changes to the file..
> >
> > print FILE $changes
Why isn't this up front where it belongs? It is what you were
responding to, so shouldn't we get to read it first, not last?
> > ----------------------------------
> > just another guy trying to save the world
> > ----------------------------------
And without that irrelevance?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Jul 1999 05:50:46 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Old database is erased when I add new information
Message-Id: <7mjsrm$1er$0@216.39.141.200>
On 15 Jul 1999 04:10:55 GMT, stanley@skyking.OCE.ORST.EDU (John Stanley)
wrote:
>In article <87hfn6mzkm.fsf@a2b01118.paralynx.bconnected.net>,
>Brad Murray <bjm@a2b01118.paralynx.bconnected.net> wrote:
>
>>Perhaps better than hiding source is a tamper-proof label. Say an MD5
>>message digest of it or something.
>
>You missed the point completely. Your reputation is hurt much less by
>someone who cannot edit your code and claim you gave them bad code in
>the first place than by someone who can do that. Your time is wasted
>much less often by someone who cannot edit the code and demand you fix
>than than someone who can.
Your reputation is enhanced by someone who can edit your code and send in
patches for overlooked bugs than by someone who cannot do that. Your time is
saved everytime by someone who can edit your code and offers to fix it for
you than by someone can't.
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: Thu, 15 Jul 1999 01:44:40 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Opposite of chr()
Message-Id: <1duym4q.1qr5wb567wg3zN@p82.tc2.metro.ma.tiac.com>
Jordan Hiller <hiller@email.com> wrote:
> I looked in the docs but I couldn't find anything to answer my question. Is
> there a function that does the opposite of chr($number), that returns a number
> when given a letter?
You must not have looked very hard.
perlfunc:
chr NUMBER
chr
Returns the character represented by that NUMBER in the character
set. For example, chr(65) is "A" in ASCII. For the reverse, use ord
in the manpage.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 14 Jul 1999 22:47:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl on NT - SIG handlers
Message-Id: <MPG.11f715d762752305989cd1@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7mibf6$jnh$1@nnrp1.deja.com> on Wed, 14 Jul 1999 15:47:55
GMT, Stephen Pandich <pandich@my-deja.com> says...
> I have a fair amount of experience with Perl on UNIX, but I am still
> pretty new to the Perl on NT world. Is anyone aware of something like
> signal handlers for NT perl?
>
> I am specifically looking for ways to trap control-c.
Did you try setting $SIG{INT} to a handler? It should work the same on
NT as on Unix.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 15 Jul 1999 01:44:41 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: regex help needed
Message-Id: <1duymgd.talknjmqaf6kN@p82.tc2.metro.ma.tiac.com>
Phil R Lawrence <prlawrence@lehigh.edu> wrote:
> DB<1> $r2 = '(?i)^(\s*(M|F|U)\,?\s*)+$'
You want to require a comma or whitespace or both after each letter.
So:
$r2 = '(?i)^(\s*[MFU][,\s]\s*)+$'
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 01:44:42 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Test if a File Exists?
Message-Id: <1duymu4.duh1k4ylo63nN@p82.tc2.metro.ma.tiac.com>
Abigail <abigail@delanet.com> wrote:
> Phone your sysadmin and ask him to read out the manual for you.
> If there are 2 sysadmins in your MIS department, they can do it
> in stereo. With 3 or more, they can sing it in an ensemble.
Oo, how about a round?
o/~
Perl is a language optimized for scanning arbitrary text files...
Perl is a language optimized for scanning ar...
Perl is a language opti...
o/~
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 16:09:27 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: time funciton or module
Message-Id: <bigiain-1507991609420001@192.168.1.1>
Jim wrote:
> Is there a built-in function or existing module which
> generates the current date in the format of 19990714?
try
sub mytime{return('19990714');}
of course, the documentation that come with perl gives you a *much* better
answer...
>
> Thanks for your time!
groan!
big
------------------------------
Date: Wed, 14 Jul 1999 23:29:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: time funciton or module
Message-Id: <MPG.11f71f952725950f989cd3@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <378d3fb2@nemo.idirect.com> on Wed, 14 Jul 1999 21:54:09 -
0700, Jim Bell <lansong@idirect.com> says...
> Is there a built-in function or existing module which
> generates the current date in the format of 19990714?
localtime; sprintf.
> Thanks for your time!
my $time = 'your' . time();
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 15 Jul 1999 01:44:43 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Tom Christiansen is a perlscript himself...
Message-Id: <1duymym.1fu1wzb16icj0eN@p82.tc2.metro.ma.tiac.com>
Dr. Who <qwerty@post.utfors.se> wrote:
> Why doesn't Larry Wall post things here?
Honestly? Because he became fed up with the low signal-to-noise ratio,
and with obnoxious newbies who expected polite answers to FAQs.
I should know; I was one of those obnoxious newbies at the time.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 15 Jul 1999 06:43:09 GMT
From: tony_d_1@my-deja.com
Subject: Unique but Simple Combinations of functions
Message-Id: <7mjvts$7ij$1@nnrp1.deja.com>
Hi, I'm new at this but I am working with a book so I'll make this
question as intelligent as I can ;-) Let's say I'm building a shopping
cart program for the web. Each individual item being sold by this store
is one of a kind, like original art work, so it is important that the
script doesn't allow two people to purchase the product at the same
time. Ideally, there should be a status output to the html indicating
that the item is either available, pending (in another users cart) or
sold. I'm also running into a logistics problem when I think about
checkout time; the script should lock up the items at some point in the
checkout procedure, but not allow some competitor (or wiseguy) to come
along and lock up all of the merchandise without finalizing a credit
card sale. This is starting to feel like a cgi question, but bare with
me, I'm not sure where to start.
I'm thinking all I have to do is add a database field that contains
either a 0,1 or 2. Then set up some conditional statements like, if the
database field for that particular item is equal to 1, the item is
currently pending. That seems simple, but what happens if a visitor
places items in their cart, then just leaves the site without checking
out. I don't know how I can make the script put the item back into the
available status.
Any thoughts about any of this?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 15 Jul 1999 00:11:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Unique but Simple Combinations of functions
Message-Id: <MPG.11f7298bcabde0eb989cd4@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7mjvts$7ij$1@nnrp1.deja.com> on Thu, 15 Jul 1999 06:43:09
GMT, tony_d_1@my-deja.com <tony_d_1@my-deja.com> says...
<SNIP> description of application-programming problem
> Any thoughts about any of this?
My thoughts are that your question has nothing to do with Perl, which is
what this newsgroup is about. Your problem could be solved using any
programming language.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 150
*************************************